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.
I thought maybe the 'l1-1-0' part might be the wrong framework version, but my dotnet version is 2.1.500.
What do I need to do to get it to work please?
Self-Contained deployment is a new deployment option that was added in . NET Core. In this mode, you compile platform specific code that is ready to run standalone in a specific target environment.
The referenced project is a non self-contained executable. A non self-contained executable cannot be referenced by a self-contained executable.
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 theRuntime & 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With