我在 Windows 托管环境中的 Plesk 面板上部署 Web API 应用程序时遇到问题。我的 appsettings.json 文件如下所示:
{ "dbConnectionString": "Data Source=.\\MSSQLSERVER2019;Initial Catalog=<DataBaseName>;User ID=<UserName>;Password=<Password>" }
<?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=".\AppName.RestApi.exe" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" /> </system.webServer> </location> </configuration>
我遇到 503 错误。我尝试将托管模型更改为进程外,但导致了 502.5 错误。
我发现问题了。我发现主机上的 .net 版本是版本 7,但我的项目是使用版本 8 构建的。