尝试发布 .net 5 Web 应用程序时出错

尝试发布 .net 5 Web 应用程序时出错

问题描述:

我在将 Web 应用程序发布到 IIS 时遇到此错误.

I got this error when I published my web application to IIS.

标题:HTTP 错误 500.19 - 内部服务器错误

Title : HTTP Error 500.19 - Internal Server Error

我查看了关于此的大多数问题,所有问题都说我应该安装一个托管包,我确实根据我的目标框架安装了最新的一个,但仍然面临这个问题.

I viewed most questions on this and all saying that I should install a hosting bundle and I did install the latest one according to my targeted framework and still facing this.

  • 1-该应用程序在来自 VS 的 IIS Express 上运行良好.

  • 1-the application works fine on IIS Express from VS.

2-我将应用程序从 Web 部署发布到本地 IIS,然后我试过了独立和依赖于框架的两种模式.

2-I published the application from web deploy to the local IIS and I tried on both modes self-contained and framework-dependent.

安装了 3 个主机包.

3-installed hosting bundle.

4 更改主机文件,即使在其他 .net 框架上也能正常工作网站.

4-changing hosts files and it works fine even on other .net frameworks sites.

5-web 配置没问题,我找不到错误的配置applicationhost.config .

5-web config is okay, I couldn't get the wrong configs in applicationhost.config .

毕竟,我仍然面临错误.请帮忙,谢谢

after all, I still facing the error. please help, thanks

我终于搞定了,这就是我所做的:

Finally I got it Works, This what I did :

  • 卸载 IIS,从程序文件中删除 IIS 文件夹并重新安装

  • Uninstall IIS , Remove IIS Folder from Program Files and install It again

安装托管捆绑包从这里

我检查了 IIS 文件夹,发现了 aspnetCore 模块

I Checked the IIS Folder and I found aspnetCore module

添加了两种模式都适用于我的已发布版本(自包含或依赖于框架)

Added the published version both modes worked for me (self -contained or framework-dependent)

问题是安装没有将aspnetcore模块添加到以前的IIS文件夹

the problem was that the installation didn't add aspnetcore modules to previous IIS Folder