gpt4 book ai didi

asp.net-mvc - "An exception occurred while processing your request. Additionally, another exception occurred while executing the custom error page..."

转载 作者:行者123 更新时间:2023-12-01 22:22:49 34 4
gpt4 key购买 nike

我正在尝试将 MVC 网站发布为 Azure 网络角色。

当我在本地运行它时,一切正常。

但是当我将其发布到 Azure 并浏览某些 MVC 操作时,我收到此错误:

Server Error in '/' Application.

Runtime Error

Description: An exception occurred while processing your request. Additionally, another exception occurred while executing the custom error page for the first exception. The request has been terminated.

我不明白错误处理程序如何遇到异常,因为错误是按默认方式处理的:

public class FilterConfig
{
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new HandleErrorAttribute());
}
}

这是我的 web.config:

<?xml version="1.0"?>

<configuration>
<configSections>
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
</sectionGroup>
</configSections>

<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
</namespaces>
</pages>
</system.web.webPages.razor>

<appSettings>
<add key="webpages:Enabled" value="false" />
</appSettings>

<system.web>
<httpHandlers>
<add path="*" verb="*" type="System.Web.HttpNotFoundHandler"/>
</httpHandlers>

<pages
validateRequest="false"
pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<controls>
<add assembly="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
</controls>
</pages>
</system.web>

<system.webServer>
<validation validateIntegratedModeConfiguration="false" />

<handlers>
<remove name="BlockViewHandler"/>
<add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
</handlers>
</system.webServer>
</configuration>

这是Error.cshtml:

@model System.Web.Mvc.HandleErrorInfo

@{
ViewBag.Title = "Error";
}

<h2>
Sorry, an error occurred while processing your request.
</h2>

什么会导致此异常,为什么我不能在本地重现它?

最佳答案

首先,在 web.config 中设置 customErrors = "Off"并重新部署以获得更详细的错误消息,这将有助于我们诊断问题。您还可以通过 RDP 进入实例并从本地 IIS 浏览到该站点以查看错误。

<system.web>
<customErrors mode="Off" />

首先猜测 - 您有一些引用(很可能是 Azure SDK 引用)未设置为 Copy Local = true。因此,您的所有依赖项都没有部署。

首先了解详细的错误并更新您的问题。

更新:VS2013 中现在可用的第二个选项是 Remote Debugging a Cloud Service or Virtual Machine .

关于asp.net-mvc - "An exception occurred while processing your request. Additionally, another exception occurred while executing the custom error page...",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17274481/

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