我正在尝试在 Azure 中托管 .NET 5 ASP.NET Core Web Api。不幸的是,该应用程序没有启动,因为“诊断问题”也出现了。看起来它陷入了启动循环,因为我一遍又一遍地在日志流中收到相同的消息:
2020-11-13T11:25:43 Start 'Microsoft.AspNetCore.AzureAppServices.SiteExtension' site extension transform
2020-11-13T11:25:44 StartSection Executing InsertIfMissing (transform line 7, 23)
2020-11-13T11:25:44 on /configuration/system.webServer
2020-11-13T11:25:44 Applying to 'configuration' element (no source line info)
2020-11-13T11:25:44 EndSection Done executing InsertIfMissing
2020-11-13T11:25:44 StartSection Executing InsertIfMissing (transform line 8, 16)
2020-11-13T11:25:44 on /configuration/system.webServer/runtime
2020-11-13T11:25:44 Applying to 'system.webServer' element (no source line info)
2020-11-13T11:25:44 EndSection Done executing InsertIfMissing
2020-11-13T11:25:44 StartSection Executing InsertIfMissing (transform line 9, 31)
2020-11-13T11:25:44 on /configuration/system.webServer/runtime/environmentVariables
2020-11-13T11:25:44 Applying to 'runtime' element (no source line info)
2020-11-13T11:25:44 EndSection Done executing InsertIfMissing
2020-11-13T11:25:44 StartSection Executing InsertOrAppendAttribute (transform line 10, 406)
2020-11-13T11:25:44 on /configuration/system.webServer/runtime/environmentVariables/add[@name='DOTNET_ADDITIONAL_DEPS']
2020-11-13T11:25:44 Applying to 'environmentVariables' element (no source line info)
2020-11-13T11:25:44 EndSection Done executing InsertOrAppendAttribute
2020-11-13T11:25:44 StartSection Executing InsertOrAppendAttribute (transform line 11, 158)
2020-11-13T11:25:44 on /configuration/system.webServer/runtime/environmentVariables/add[@name='DOTNET_SHARED_STORE']
2020-11-13T11:25:44 Applying to 'environmentVariables' element (no source line info)
2020-11-13T11:25:44 EndSection Done executing InsertOrAppendAttribute
2020-11-13T11:25:44 StartSection Executing InsertOrAppendAttribute (transform line 12, 146)
2020-11-13T11:25:44 on /configuration/system.webServer/runtime/environmentVariables/add[@name='ASPNETCORE_HOSTINGSTARTUPASSEMBLIES']
2020-11-13T11:25:44 Applying to 'environmentVariables' element (no source line info)
2020-11-13T11:25:44 EndSection Done executing InsertOrAppendAttribute
2020-11-13T11:25:44 Successful 'C:\home\SiteExtensions\Microsoft.AspNetCore.AzureAppServices.SiteExtension\applicationHost.xdt' site extension transform
2020-11-13T11:25:44 sandboxproc.exe complete successfully. Elapsed = 1208.00 ms
2020-11-13T11:25:56 sandboxproc.exe D:\DWASFiles\Sites\fotoapp-api\Temp\applicationhost.config True True
2020-11-13T11:25:57 env XPROC_TYPENAME=Microsoft.Web.Hosting.Transformers.ApplicationHost.SiteExtensionHelper, Microsoft.Web.Hosting, Version=7.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
2020-11-13T11:25:57 env XPROC_METHODNAME=Transform
<these messages repeat endlessly>
我尝试了依赖于框架的部署(在应用服务中启用了 .NET 5 运行时)以及独立部署。
我在任何地方都找不到更好的日志。尚不支持 Application Insights。
对 API 的请求不会到达日志流。约 2 分钟后,服务器响应“HTTP 错误 503。服务不可用”。
最佳答案
我也遇到这个错误。
就我而言,问题与Azure App Service 64位/32位平台设置(Web应用程序\配置\常规设置\平台设置 )。
我最近将其更改为 64 位,然后开始出现此错误,当我恢复到 32 位时,问题就消失了。
我还没有确定根本原因,但就其值(value)而言,它就在那里。
关于.NET 5 ASP.NET Core 应用程序未在 Azure 中启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64820156/