asp.net core接口报500错误排查

接口已经进行了try catch捕捉,但是还是报错,放到web.config下的错误,主要是是将stdoutLogEnabled修改为true

 <aspNetCore processPath="dotnet" arguments=".\xxxx.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />

在logs\stdout下看到了错误日志

fail: Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer[2]
      Connection ID "18230571293206380594", Request ID "80000056-0000-fd00-b63f-84710c7967bb": An unhandled exception was thrown by the application.
      System.UnauthorizedAccessException: Access to the path 'C:\Windows\TEMP\ASPNETCORE_xxxx.tmp' is denied.

找到项目的应用程序池,将高级设置中“加载用户配置文件”(Load User Profile)设置为true即可。

参考

你可能感兴趣的:(dotnet,asp.net,后端)