"An exception occurred while processing your request. In addition, another exception occurred while executing the custom page of the error ..."

I am trying to publish an MVC website as an Azure website.

When I run it locally, everything works fine.

But as soon as I post it before Azure and move on to some MVC action, I get this error:

Server error in application "/".

Runtime error

Description: An exception occurred while processing your request. Additionally, when executing custom page errors for the first exception. Request completed.

I don’t understand how an error handler can throw an exception because errors are handled by default:

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

This is my 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> 

This is Error.cshtml:

 @model System.Web.Mvc.HandleErrorInfo @{ ViewBag.Title = "Error"; } <h2> Sorry, an error occurred while processing your request. </h2> 

What can cause this exception and why I cannot reproduce it locally?

+90
asp.net-mvc web-config asp.net-mvc-4
Jun 24 '13 at 11:34 on
source share
6 answers

First set customErrors = "Off" in the web.config file and redeploy it to get a more detailed error message that will help us diagnose the problem. You can also include RDP in the instance and go to the site from IIS locally to view errors.

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

First, suppose you have links (most likely links to the Azure SDK) that are not set to Copy Local = true. Thus, all your dependencies are not deployed.

First go to the detailed error and update your question.

UPDATE: The second option available in VS2013 is Remote debugging of a cloud service or virtual machine .

+194
Jun 27 '13 at 2:23
source share

I did not use Azure, but I got the same error locally. Using <customErrors mode="Off" /> did not seem to have any effect, but checking the application logs in the event viewer revealed an ASP.NET warning that indicated all the details needed to solve the problem.

+6
Oct 07 '15 at 21:37
source share

If you add this to your web.config conversion file, you can also set certain publishing options to enable or disable debugging:

 <system.web> <customErrors mode="Off" defaultRedirect="~/Error.aspx" xdt:Transform="Replace"/> </system.web> 
+2
Mar 15 '18 at 14:30
source share

Make sure you clear ModelState errors or keep trying to handle them.

 foreach (var modelValue in ModelState.Values) { modelValue.Errors.Clear(); } 
0
Feb 10 '16 at 19:31
source share

I only had this problem with redirectMode="ResponseRewrite" ( redirectMode="ResponseRedirect" worked fine) and none of the above solutions helped me solve the problem. However, after I changed the application pool of the Managed Pipeline Server server from Classic to Integrated, the user page appeared with an error, as expected.

0
Mar 08 '18 at 18:19
source share

Instead, you can use Oracle.ManagedDataAccess.dll (download from Oracle), include this dll in the bin folder of the project, add a link to this dll in the project. In the code "using Oracle.MangedDataAccess.Client." Deploy the project on the server as usual. No need to install Oracle Client on the server. There is no need to add assembly information to web.config.

0
Apr 01 '19 at 14:33
source share



All Articles