.NET Core-自包含部署无法正常工作 [英] .NET Core - Self Contained Deployment not working

查看:313
本文介绍了.NET Core-自包含部署无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个.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:

HTTP错误500.19 –内部服务器错误

HTTP ERROR 500.19 – Internal Server 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.

一个独立的部署确实包含运行时,但是 它不包含您得到的ASP.NET Core module for IIS .net下载中下载Runtime & Hosting Bundle时 页面.

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.

因此,如果要部署到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-自包含部署无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆