2016-04-10 26 views
5

我在我的web.config文件中的以下设置来处理错误:如何停止Azure的IIS附加错误状态代码查询字符串

<httpErrors errorMode="Custom" existingResponse="Replace"> 
    <remove statusCode="500" /> 
    <error statusCode="500" responseMode="ExecuteURL" path="/error/internalservererror/" /> 
</httpErrors> 

当我把我的应用程序异常正常工作在本地,但它重定向到在蔚蓝的错误页面下面的网址(注意页面我抛出异常从位于URL的末尾:

https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/about/

如何阻止IIS在Azure中显示此行为?

+0

只是想你的配置,但不能重现此问题,在本地运行时,做工精细发布到天蓝。我想知道你在IIS上是否有其他重定向规则? – forester123

回答

1

只需在path参数的末尾添加一个问号,使用你的代码,你有这样的事情:

<httpErrors errorMode="Custom" existingResponse="Replace"> 
    <remove statusCode="500" /> 
    <error statusCode="500" responseMode="ExecuteURL" path="/error/internalservererror/?" /> 
</httpErrors> 
+0

我无法使用此答案解决问题?我正在使用Rehan的MVC 5 Boilerplate模板。有什么建议么? – zbarrier

+0

这不起作用。 –

+0

这背后的逻辑是什么?顺便说一句,这是行不通的。 –