180

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?

Kols
  • 3,641
  • 2
  • 34
  • 42
King Kong
  • 2,855
  • 5
  • 28
  • 39

3 Answers3

297

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:

CustomErrors mode="Off"

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
jim tollan
  • 22,305
  • 4
  • 49
  • 63
167

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>
Meer
  • 2,765
  • 2
  • 19
  • 28
  • 1
    For more detail see [customErrors Element (ASP.NET Settings Schema)](https://msdn.microsoft.com/en-us/library/h0hfz6fc(v=vs.85).aspx) – stomy Oct 30 '17 at 16:58
  • See [httperrors](https://learn.microsoft.com/en-us/iis/configuration/system.webserver/httperrors/) – stomy Oct 30 '17 at 17:01
  • See [the difference between customErrors and httpErrors](https://stackoverflow.com/a/2481102/7794769) – stomy Oct 30 '17 at 17:05
  • 4
    This is better than the accepted answer bcuz most devs want to see the details instead of YSOD with no details. – Spencer Nov 30 '17 at 18:12
16

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());
}
Sandrino Di Mattia
  • 24,739
  • 2
  • 60
  • 65
  • Would I have access to this **Global.asax.cs** file in a `plesk` environment? And where is that file located? The other suggestions are not working; and I need it for a sub-domain. – MeSo2 Dec 08 '22 at 18:45