IIS 发布 遇到的坑 HTTP 错误 500.19 - Internal Server Error

本文解决因缺少模块而导致的AspNetCoreModuleV2报错问题,介绍如何下载并安装包含ASP.NET Core IIS Module的Windows Hosting Bundle,确保.NET Core和ASP.NET Core运行时正确配置。

微软官网,几乎没啥用

Internet 信息服务 (IIS) 网页上的 HTTP 错误 500.19 - Internet Information Services | Microsoft Learn

情况1:

报错 modules="AspNetCoreModuleV2" 主要是由于缺少模块导致

<?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=".\YiSha.Admin.Web.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
    </system.webServer>
  </location>
</configuration>
<!--ProjectGuid: 06f9bbca-932b-4ab1-940c-e604ac82fa0f-->

解决办法下载bundle(包含 ASP.NET Core IIS Module)

Download ASP.NET Core 3.1 Runtime (v3.1.4) - Windows Hosting Bundle Installer

contains everything you need to run existing web/server apps. The bundle includes the .NET Core runtime, the ASP.NET Core runtime, and if installed on a machine with IIS it will also add the ASP.NET Core IIS Module. If you only want the .NET Core or ASP.NET Core runtime, you'll find them in .NET Core 3.1 Downloads.

执行 dotnet --version 及dotnet --info 显示如下

Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.

C:\Users\wuxx>dotnet --version
3.1.201

C:\Users\wuxx>dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   3.1.201
 Commit:    b1768b4ae7

Runtime Environment:
 OS Name:     Windows
 OS Version:  6.3.9600
 OS Platform: Windows
 RID:         win81-x64
 Base Path:   C:\Program Files\dotnet\sdk\3.1.201\

Host (useful for support):
  Version: 3.1.3
  Commit:  4a9f85e9f8

.NET Core SDKs installed:
  3.1.201 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

情况2:迁移后,服务器环境不一致导致IIS没法正常加载web.config

需要安装dotnet-hosting-8.0.11-win 才能解决

 

下载地址如下:

.NET 下载(Linux、macOS 和 Windows)


参考:
IIS:执行此操作时出错。文件名: \\?\D:\****\web.config - 新* - 博客园

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值