How to set web.config file to show full error message

C#asp.netasp.net Mvc-3Web Config

C# Problem Overview


I deployed my MVC-3 application on windows Azure. But now when I am requesting it through staging url it shows me (Sorry, an error occurred while processing your request.). Now I want to see the full error message, by default it is hiding that because of some security reasons. I know that we can do this through web.config file. But how?

C# Solutions


Solution 1 - C#

Not sure if it'll work in your scenario, but try adding the following to your web.config under <system.web>:

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

works in my instance.

also see:

https://stackoverflow.com/questions/101693/customerrors-mode-off

Solution 2 - C#

This can also help you by showing full details of the error on a client's browser.

<system.web>
	<customErrors mode="Off"/>
</system.web>
<system.webServer>
    <httpErrors errorMode="Detailed" />
</system.webServer>

Solution 3 - C#

If you're using ASP.NET MVC you might also need to remove the HandleErrorAttribute from the Global.asax.cs file:

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionKing KongView Question on Stackoverflow
Solution 1 - C#jim tollanView Answer on Stackoverflow
Solution 2 - C#MeerView Answer on Stackoverflow
Solution 3 - C#Sandrino Di MattiaView Answer on Stackoverflow