• 【Azure 应用服务】通过 Web.config 开启 dotnet 应用的 stdoutLog 日志,查看App Service 产生500错误的原因


    问题描述

    Web App(App Service) 经常出现500错误,但是通过高级管理工具(Kudu站点)查看了所有的日志,均没有定位到具体的原因,有那些方式可以查看到更多的信息呢?

    问题解答

    HTTP 500 错误通常表明应用程序代码问题, 应用程序代码中的未处理异常或应用程序中的错误通常是导致此错误的原因。如果为 App Service开启应用服务日志来查看相应的异常信息是非常有帮助的。而如是 .Net 应用,也可以通过web.config 来开启 stdoutLogEnabled,即可以在日志中查看到未捕获的异常信息。 

     

    web.config内容如下

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <!-- To customize the asp.net core module uncomment and edit the following section. 
      For more info see https://go.microsoft.com/fwlink/?linkid=838655 -->
      <system.webServer>
        <!--<httpProtocol>
          <customHeaders>
            <clear />
            <add name="Cache-Control" value="no-cache" />
          </customHeaders>
          
        </httpProtocol>-->
        <handlers>
          <remove name="aspNetCore" />
          <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
        </handlers>
        <aspNetCore processPath="dotnet" arguments=".\NetCoreWebAPI.dll" stdoutLogEnabled="true" stdoutLogFile="\\?\%home%\LogFiles\stdout">
          <environmentVariables />
        </aspNetCore>
      </system.webServer>
    </configuration>

    效果如下:

     

  • 相关阅读:
    求1977!
    三进制小数
    回文数C语言
    JAVA知识点必看
    servlet HttpServletRequest
    为什么web工程要输入localhost或者是127.0.0.1
    service $sce or ng-bind-html
    jQuery的deferred对象详解
    理解promise
    理解Angular中的$apply()以及$digest()
  • 原文地址:https://www.cnblogs.com/lulight/p/15872724.html
Copyright © 2020-2023  润新知