gpt4 book ai didi

asp.net - httpErrors 配置部分在 Windows Azure 中不起作用

转载 作者:行者123 更新时间:2023-12-02 23:21:34 25 4
gpt4 key购买 nike

我的网站配置为在发生错误时显示自定义 HTML 页面。这在 IIS 和 ASP.NET 开发服务器上都可以正常工作。但是,当我将应用程序部署到 Windows Azure 时,对于非 ASP.NET-URL,我得到的是 HTTP 500,而不是 404。

相关的 web.config 部分如下所示:

<httpErrors errorMode="Custom">
<clear />
<error statusCode="404" path="/Public/Error404.html" responseMode="ExecuteURL" />
</httpErrors>

<customErrors defaultRedirect="/Public/Error.html" mode="On">
<error redirect="/Public/Error404.html" statusCode="404" />
</customErrors>

customErrors部分(应用于以 .aspx 结尾的 URL)工作正常。 httpErrors然而,该部分没有。即使 Azure 的 IIS 向浏览器发送 500,它也会记录 404:

2012-02-10 13:30:07 W3SVC1273337584 RD00155D3A1439 10.61.70.39 GET /asdfdsaafds - 80 - 65.52.128.172 HTTP/1.1 Mozilla/4.0+(compatible;+MSIE+8.0;+Windows+NT+6.1;+WOW64;+Trident/4.0;+SLCC2;+.NET+CLR+2.0.50727;+.NET+CLR+3.5.30729;+.NET+CLR+3.0.30729;+.NET4.0C;+.NET4.0E) - - 940af2dbd9df4924b87a13878752aee3.cloudapp.net 404 0 2 222 457 218

在本地,我收到 HTTP 500.19,其中包含一些更详细的信息:

The requested page cannot be accessed because the related configuration data for the page is invalid.

Config Error Lock violation

238: <httpErrors errorMode="Custom" defaultPath="/Public/Error.html" existingResponse="Replace" defaultResponseMode="ExecuteURL">

谷歌搜索锁定冲突对我没有太大帮助,因为结果通常告诉我有关独立 IIS 的信息。 Windows 事件日志中没有任何错误。

我想显示 Error404.html对于 Azure 和独立 IIS 上的任何 404。任何帮助都会很棒。

最佳答案

那么,显而易见的问题是:您是否确定您的自定义错误页面实际上已部署到您的 Azure Web 角色实例?

第二个问题:它可以在 Azure 模拟器中运行吗?

更新:
该错误消息表明配置部分已锁定在您的目标 II 上。
阅读此Introduction to ApplicationHost.config 。您可能需要解锁 httpErrors 部分。

此外,请查看 this solution对于类似的错误。

关于asp.net - httpErrors 配置部分在 Windows Azure 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9229208/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com