Edit: showed my exact web.config code.
I have a MVC3 project that works fine on my box, but when I upload it to the web server, it gives an error on a certain page. I am trying to determine the exact error, but it keeps redirecting to the "Error/ShowError" action. I tried modifying the web.config file to say showcustomerrors=false, but it still redirects. I really need to see the actual error in order to troubleshoot the problem.
In firebug, it shows that the error is a 500 internal server error. I haven't been able to get any more detailed than that.
Also, if I run the page from my local box, but use the remote database, I don't get an error. This makes me think it's related to directory permissions.
Here is in my web.config section:
<compilation debug="true" targetFramework="4.0">
Here is in my web.debug.config section:
<customErrors mode="Off">
Thanks!
See if these changes will help.
<configuration>
<system.webServer>
<httpErrors errorMode="Detailed" />
</system.webServer>
<system.web>
<customErrors mode="Off"/>
<compilation debug="true"/>
</system.web>
</configuration>
If not, make sure that AspNet is properly installed.
C:\Windows\Microsoft.Net\Framework..\v.....\aspnet_regiis.exe -i
Edit:
You can try to log the exception message using the following method in Global.asax.cs
protected void Application_Error(object sender, EventArgs e) {
var exception = Server.GetLastError();
// Log the exception
}
Edit:
Well, this will be a lot to do, but I suggest you to add Elmah to your project to log unhandled exceptions. See the first step on Logging in MVC Part 1- Elmah
Elmah is available on NuGet Gallery.
Turn off customErrors
in web.config and you will be able to see what the error is. then fix it. Turn the Custom Error on
<customErrors defaultRedirect="Error.aspx" mode="Off"/>
Here are the options you have for custom errors:
<customErrors defaultRedirect="url"
mode="On|Off|RemoteOnly">
<error. . ./>
</customErrors>
I think your issue is that you're using 'false' instead of 'Off'.
Good luck, hope this works for you.
Reference: MSDN link for CustomErrors section