所需材料:
IIS,dotnet-hosting-6.0.6-win.exe(通过IIS调用runtime组件,相当于IIS与runtime之间的粘合剂),aspnetcore-runtime-6.0.6-win-x64。
下载地址分别为:
https://download.visualstudio.microsoft.com/download/pr/0d000d1b-89a4-4593-9708-eb5177777c64/cfb3d74447ac78defb1b66fd9b3f38e0/dotnet-hosting-6.0.6-win.exe
https://download.visualstudio.microsoft.com/download/pr/7751b01b-4548-478d-ac63-ca57f2b66a3f/3339efd1fde8f62fed0ac2406f8bc559/aspnetcore-runtime-6.0.6-win-x64.exe
HTTP Error 500.19 - Internal Server Error The requested page cannot be accessed because the related configuration data for the page is invalid.
原因:
1.先安装.net freamework后安装IIS,导致framework没有注册到IIS中。
如果为此情况,使用以下命令进行注册(到指定的framework安装目录下运行):
aspnet_regiis -i
2.文件夹权限不够:添加(everyone)的modify权限,或者计算机名/IIS_IUSERS的相应权限。
HTTP Error 500.30 - ASP.NET Core app failed to start
原因:
1.文件夹权限不够并且不要在代码中指定端口,改用配置文件端口。
app.Run(); //app.Run("http://*:4000");在appsettings.json文件添加:
"Kestrel": { "Endpoints": { "Https": { "Url": "https://*:5701" }, "Http": { "Url": "http://*:5700" } } }
2.文件夹权限不够:添加(everyone)的modify权限,或者计算机名/IIS_IUSERS的相应权限。