7
votes

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
"After installing .NET Core Hosting bundle it works fine." Then why do you ask this question? The answer is so clear. - Lex Li
@Lex Li - Because a self contained install should install the framework as well to save having to do it separately. Think the downvote was a bit harsh for a legitimate and well researched post. - HockeyJ
Unfortunately it is you who don't understand the topic. Microsoft defines what is "self contained" (so ASP.NET Core module is not there by design) and that's just what you observed. Unless you have the power to force Microsoft changes its mind, this question has no answer. blog.lextudio.com/… - Lex Li
Then please kindly tell me what I'm misunderstanding - even after reading docs.microsoft.com/en-us/dotnet/core/deploying as well as many other docs . What is even the point of a self contained install if you have to install the framework anyway? - HockeyJ
The key points for self deployment are 1) in the separate download only ASP.NET Core module for IIS matters (the runtime bundled is ignored). 2) you decide what runtime is shipped with your web app, not the separate installer. Whether that's a good design or not is something you can challenge Microsoft on. Such are implicitly mentioned in Microsoft docs, and you can only figure them out by experiments. - Lex Li

1 Answers

9
votes

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.