.NET Core - Self Contained Deployment not working

Viewed 2673

I have a .NET Core Web Application. I'm using the publish command to create a self contained deployment.

It creates the files and appears to create .net core dlls, but when runnning in IIS on Windows 10, I still need to install the .NET Core Runtime to get it to work. After installing .NET Core Hosting bundle it works fine.

I have reviewed a lot of other posts before asking, but can't find the answer.

By default IIS gives the following error:

HTTP ERROR 500.19 – Internal Server Error

My Publish command:

dotnet publish "mydirectory\mywebsite.csproj" --self-contained --framework netcoreapp2.1 -r win10-x64 -c Release

The csproj looks like this:

 <PropertyGroup>
    <TargetFramework>netcoreapp2.1</TargetFramework>
    <UserSecretsId>aspnet-mywebsite-656GASF8-B9H4-5963-1038-5D735B609E15</UserSecretsId>
      <RuntimeIdentifiers>win10-x64</RuntimeIdentifiers>
  </PropertyGroup>

Here are the published files.

enter image description here

I thought maybe the 'l1-1-0' part might be the wrong framework version, but my dotnet version is 2.1.500.

enter image description here

What do I need to do to get it to work please?

1 Answers

Lex Li's comment/ blog post contains the answer. I'm detailing it here to try to save someone else losing days to this simple misunderstanding.

A self contained deployment does indeed include the runtime, but it doesn't include the ASP.NET Core module for IIS which you get when you download the Runtime & Hosting Bundle from the .net downloads page.

So if you are deploying to IIS, you will need to run the Runtime & Hosting Bundle installer even for a self contained deployment.

A self contained deployment just means the application will use the .NET Core Runtime packaged with the application rather than whatever is installed on the machine.

Related