简体   繁体   English

Do.net Core 3.1 HTTP 错误 500.19 - 内部服务器错误

[英]Dotnet Core 3.1 HTTP Error 500.19 - Internal Server Error

I was trying to create a simple (default) Web API using do.net core 3.1 in Visual Studio 2019 using "ASP.NET Core Web Application".我试图使用“ASP.NET Core Web 应用程序”在 Visual Studio 2019 中使用do.net core 3.1创建一个简单的(默认)Web API。

Once I created the (default) application and I was able to run it on IIS Express by pressing F5 in Visual Studio.创建(默认)应用程序后,我可以通过在 Visual Studio 中按 F5 在 IIS Express 上运行它

Then I want to publish so I went to windows features and turned on IIS then configured it by installing "WebPlatformInstaller_x64_en-US.msi" and "do.net-hosting-3.1.2-win.exe" (for dot.net core).然后我想发布所以我去了 windows 功能并打开 IIS 然后通过安装“WebPlatformInstaller_x64_en-US.msi”“do.net-hosting-3.1.2-win.exe” (对于 dot.net 核心)进行配置.

Then I ran the following in command prompt:然后我在命令提示符下运行了以下命令:

net stop was /y
net start w3svc

I did the publish using "Default Web Site/Test" configuration pointing to host: http://localhost and Self Contain Package with DotNet Core 3.1.我使用指向主机的“默认 Web 站点/测试”配置进行了发布http://localhost和带有 DotNet Core 3.1 的 Self Contain Package。

Also created a Application pool with "No Managed Code"还创建了一个“无托管代码”的应用程序池

应用程序池

When I went to http://localhost/Test I got the following error message:当我访问http://localhost/Test,我收到以下错误消息:

错误信息

Here is my Web.Config :这是我的Web.Config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
  <handlers>
    <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
  </handlers>
  <aspNetCore processPath="dotnet" arguments=".\TestApp.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
    </system.webServer>
  </location>
</configuration>
<!--ProjectGuid: 63addee1-2c1f-4679-94f4-df9dc952d8f9-->

I'm not sure if this is relevant information, when I did Pass-through Authentication test in IIS I'm getting the following:我不确定这是否是相关信息,当我在 IIS 中进行直通身份验证测试时,我得到以下信息:

透传认证测试结果

I tried so many different ways of publishing and they all at the end getting the above error message.我尝试了很多不同的发布方式,但最后都收到了上述错误消息。 How can we resolve this?我们如何解决这个问题?

  1. ensure corresponding Application Pool configured with No Managed Code确保相应的应用程序池配置了无托管代码
  2. ensure you've installed .NET Core Hosting Bundle确保您已安装.NET Core Hosting Bundle

IMO, I will say you take a look through this walkthrough: IMO,我会说你看看这个演练:

https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-3.1 https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-3.1

Try check if Windows Process Activation Service (WAS) is activated on your system (server).尝试检查您的系统(服务器)上是否激活了 Windows Process Activation Service (WAS)。

Turn stdoutLogEnabled="true" to get more detailed error from the app in a log file.打开 stdoutLogEnabled="true" 以从日志文件中的应用程序获取更详细的错误。 Or turn on Developer Error Page in your Startup.cs class.或者在您的 Startup.cs 类中打开开发人员错误页面。

At My case, I attach .NET Core 3.1 apps on IIS win server 2019就我而言,我在 IIS win server 2019 上附加了 .NET Core 3.1 应用程序

I have installed .net core 3.1 runtime, and Hosting bundle, but something goes wrong我已经安装了 .net core 3.1 runtime 和 Hosting bundle,但是出了点问题

saka_iis

when I check at local compter I am missing:当我在本地计算机上检查时,我丢失了:

Microsoft.WindowsDesktop.App 3.1.23 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

After I install .net Core Desktop Runtime the error gone.安装 .net Core Desktop Runtime 后,错误消失了。

命令

运行

Maybe the runtime need another installer..也许运行时需要另一个安装程序..

It turned out to be our server was not allowed to have IIS turned on.原来是我们的服务器不允许开启IIS。 It was configured as a data server .它被配置为数据服务器 I had to get special permission to run IIS, then everything seems to work fine.我必须获得特别许可才能运行 IIS,然后似乎一切正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM