gpt4 book ai didi

asp.net - asp.net MVC3 中的错误处理

转载 作者:行者123 更新时间:2023-12-04 06:31:37 27 4
gpt4 key购买 nike

我创建了一个 MVC3 应用程序并在 web.config 中添加了 cutomerrors 属性 on。它适用于 chrome 和 Firefox 但是当我在 IE9 中运行它时,我得到

网站无法显示页面

HTTP 500

最可能的原因:•网站维护中。•网站有程序错误。

你可以尝试什么:

<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=152368
-->

<configuration>
<appSettings>
<add key="ClientValidationEnabled" value="true"/>
<add key="UnobtrusiveJavaScriptEnabled" value="true"/>
</appSettings>

<system.web>
<customErrors mode="On"></customErrors>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>

<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="2880" />
</authentication>

<pages>
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages"/>
</namespaces>
</pages>
</system.web>

<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

最佳答案

Internet Explorer 版本中存在一个已知问题,自定义错误页面必须至少为 512 字节。虽然这通常适用于旧的 IE 版本并且通常会导致 404 错误页面,但我建议确保您的自定义错误页面大小为 1 kB。您可能会放入一些 HTML 注释或其他内容。只是为了确保它与那个旧的 IE 错误无关。

只是众多引用中的一个: http://perishablepress.com/press/2008/01/21/important-note-for-your-custom-error-pages/

关于asp.net - asp.net MVC3 中的错误处理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5349867/

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