问题描述
我有一个.NET Core Web应用程序.我正在使用发布命令创建自包含部署.
I have a .NET Core Web Application. I'm using the publish command to create a self contained deployment.
它创建文件并似乎创建.net核心dll,但是在Windows 10上的IIS中运行时,我仍然需要安装.NET Core运行时以使其正常运行.安装.NET Core Hosting捆绑包后,它可以正常工作.
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.
默认情况下,IIS给出以下错误:
By default IIS gives the following error:
我的发布命令:
dotnet publish "mydirectory\mywebsite.csproj" --self-contained --framework netcoreapp2.1 -r win10-x64 -c Release
csproj看起来像这样:
The csproj looks like this:
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<UserSecretsId>aspnet-mywebsite-656GASF8-B9H4-5963-1038-5D735B609E15</UserSecretsId>
<RuntimeIdentifiers>win10-x64</RuntimeIdentifiers>
</PropertyGroup>
这是已发布的文件.
我以为'l1-1-0'部分可能是错误的框架版本,但我的dotnet版本是2.1.500.
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?
推荐答案
Lex Li的评论/博客文章包含答案.我在这里详细介绍它,以试图避免其他人因这种简单的误解而损失数天.
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.
因此,如果要部署到IIS,则即使是自包含部署,也将需要运行Runtime & Hosting Bundle
安装程序.
So if you are deploying to IIS, you will need to run the Runtime & Hosting Bundle
installer even for a self contained deployment.
一个自包含的部署仅意味着该应用程序将使用该应用程序打包的.NET Core Runtime,而不是计算机上安装的任何内容.
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.
这篇关于.NET Core-自包含部署无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!