Netcore5 發布IIS
問題1:報404錯誤
解決方案:需要安裝 AspNetCoreModeuleV2
文檔地址 https://dotnet.microsoft.com/download/dotnet/5.0
問題2:報錯信息:
Error.
An error occurred while processing your request.
Request ID: 00-84505f59efe45c4f986b977926902b81-b2da05dfbb855941-00
Development Mode
Swapping to Development environment will display more detailed information about the error that occurred.
The Development environment shouldn't be enabled for deployed applications. It can result in displaying sensitive information from exceptions to end users. For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development and restarting the app.
解決方案:需要修改配置文件
<aspNetCore processPath=".\Application.exe" arguments="" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false">
<environmentVariables>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Production" />
</environmentVariables>
</aspNetCore>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Production" />
修改為:
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
問題3:報錯信息:
An unhandled exception occurred while processing the request.
異常詳細信息: System.Data.SqlClient.SqlException:用戶 'IIS APPPOOL\DefaultAppPool' 登錄失敗解決辦法
解決方案:
打開 Microsoft SQL Server Management Studio
1.安全性---登錄名---新建登錄名
2.常規----搜索
3.添加SERVICE用戶--
4.服務器角色---勾上sysadmin:
IIS中:
應用程序池---對應的程序池上右鍵---高級設置
進程模塊---標識---選擇NetworkService(與數據庫中設置統一)