Muh*_*eed 5 iis asp.net-mvc azure http-error azure-web-sites
我在web.config文件中进行了以下设置来处理错误:
<httpErrors errorMode="Custom" existingResponse="Replace">
<remove statusCode="500" />
<error statusCode="500" responseMode="ExecuteURL" path="/error/internalservererror/" />
</httpErrors>
Run Code Online (Sandbox Code Playgroud)
当我在我的应用程序中抛出异常时,它在本地工作正常,但它重定向到azure中错误页面中的以下URL(请注意,我抛出异常的页面位于URL的末尾:
如何阻止IIS在Azure中检测此行为?
小智 1
只需在路径参数末尾添加一个问号,使用您的代码您将得到如下所示的内容:
<httpErrors errorMode="Custom" existingResponse="Replace">
<remove statusCode="500" />
<error statusCode="500" responseMode="ExecuteURL" path="/error/internalservererror/?" />
</httpErrors>
Run Code Online (Sandbox Code Playgroud)