Problem with getting custom errors to display on IIS7 - c#

We're running a site built in EPiServer (CMS5 R2, latest version) and ASP.NET 3.5 that's running on IIS7, we've built a custom error handler that utilizes the URLRewriter-functionality of EPiServer to handle 404 and 301 status codes, everything works locally (Windows 7 + IIS7.5) but we just can not get the 404 pages to work on the live server (Windows 2008 Server + IIS7). The 301-redirects work but for the 404-page we just get the default IIS7 message:
iis7 default 404 message http://episerversucks.com/upload/iis7_error.png
The handler is obviously getting fired since the pre-defined 301-redirects work (URLs from an old site that we need to redirect to the new site), but for the 404 IIS7 just replaces them with it's default message.
The 404 handler works in such a way that is does an internal redirect to a page /Pages/Error404.aspx that display a nice customized 404-page in an appropriate language and sets it's own status code to 404 through Response.StatusCode = 404; I got the tip from a site to change TrySkipIisCustomErrors variable to true, i.e. Response.TrySkipIisCustomErrors = true;but that didn't help either.
The only configuration difference I've found between the local dev machines and the server is that the local machines have a configuration setting called ".NET Error Pages" and a setting called just "Error Pages", while the live server only has the setting called "Error Pages" and is missing the .NET Error pages ones, but I've found no way to add the .NET Error Pages config dialog to the server, is it IIS7.5 specific?
I've been digging my way through this for the better part of a day and just can not find a solution that seems to work, so I turn here.
Edit: The local dev version and the live version have identical web.config's, settings, etc. (except for the database connection string obviously)

Ok so I solved it, the problem was setting the errorMode to "Detailed."
<configuration>
<system.webServer>
<httpErrors errorMode="Detailed" />
</system.webServer>
</configuration>
If it's on Custom the IIS7-error handler intercepts all pages that return 404 and switches the response out.

Related

HTTP Error 403.14 - Forbidden with Debug of ASP.NET Web Application

I'm trying to start ASP.NET Web Application
but I got this error with debug:
HTTP Error 403.14 - Forbidden The Web server is configured to not list
the contents of this directory.
Module
   DirectoryListingModule
Notification
   ExecuteRequestHandler
Handler
   StaticFile
Error Code
   0x00000000
Not sure if it exactly what I have to do, but as it shown, I must follow this instruction but when I'm trying to open IIS Manager on Windows 10, it says that the Windows cannot find 'inetmgr'.or 'inetmgr.exe'
So not sure what I have to do to figure out with this error.
Since it doesn't seem like you have the full IIS installed, try adding this into your web.config that lies within the directory you want to browse:
<system.webServer>
<directoryBrowse enabled="true"/>
</system.webServer>
...at least so you can get past this problem. If you're doing this for debugging, fine, but you have to seriously consider whether this is really what you want to allow on a production server.

Callback request failed due to an internal server error after publishing a website Through IIS

I have implemented my code and it works fine in visual studio 2015 but when I deploy the web site to the IIS. It Work fine in my local machine.
While opening other system thorugh my ip it does not show any validation message. It shows error message is "Callback request failed due to an internal server error." doesn't view my message.
can any one help me
Simple mistake go to web Config file
change to
<customErrors mode="Off" />
may be it will work

ASP.NET project not building in my Testing machine

I have a running project that I need to modify. I am trying to load the whole project into my Visual Studio 15 CE for modifying. I have got the whole list of files in my Solution explorer and then also the database in SQL manager. When I click execute, it gives an error list! Here is the image. enter image description here
Then In the Browser, I get this message:
HTTP Error 500.24 - Internal Server Error
An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode.
Most likely causes:
system.web/identity#impersonate is set to true.
Things you can try:
If the application supports it, disable client impersonation.
If you are certain that it is OK to ignore this error, it can be disabled by setting system.webServer/validation#validateIntegratedModeConfiguration to false.
Detailed Error Information:
Module ConfigurationValidationModule
Notification BeginRequest
Handler StaticFile
Error Code 0x80070032
Requested URL http://localhost:55014 /fanKc9TuE6zuHQVMTPwHWVIHJCM.html
Physical Path H:\Quoting system files\MGF_LIVE_BACKUP\fanKc9TuE6zuHQVMTPwHWVIHJCM.html
Logon Method Not yet determined
Logon User Not yet determined
Request Tracing Directory D:\Old folders\Documents\IISExpress \TraceLogFiles\MGF_LIVE_BACKUP
This is an application Pool setting issue..
Try going into IIS and changing the app pool for your application to use classic mode instead of integreted mode.
Alternatively you can add this to your Web.Config:
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>

Why is my application returning the IIS 404 page on my dev environment but not test or production?

OK, so I develop my application locally at http://dev.myapplication.com (using hosts file for the DNS), and then I have http://test.myapplication.com and http://www.myapplication.com.
In IIS 7 (same version, dev test and live), I've opened 'Error Pages' and edited the 404 status code to go to path '/en/404.mvc'. This works locally and I can navigate to http://dev.myapplication.com/non-existent-url.mvc which produces the 404 page.
However, if I navigate to http://dev.myapplication.com/non-existent-url (ie a static address) it shows the IIS 404 page and says it was handled by the static file handler rather than my mvc file handler.
I'm baffled as to why this happens, as it has successfully modified my web.config which in turn allows it to work on test and live, just not locally. i.e. http://www.myapplication.com/404 will show my customized 404 page
You need a wildcard mapping to run all requests through aspnet_isapi - this article explains it nicely: http://www.asp.net/mvc/tutorials/older-versions/deployment/using-asp-net-mvc-with-different-versions-of-iis-cs
Also, check your web.Config has these settings:
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>

Seeing a generic 500 internal error, how to view detailed error?

On my production server, I just deployed a asp.net web application.
I am seeing a generic '500 internal server error'.
How can I view a detailed error temporarily until I fix the problem?
I already have:
<customErrors mode="Off" defaultRedirect="error.aspx"/>
<customErrors mode="Off" /> is usually enough. But if you have messed up with some IIS configuration it won't even reach your web.config which might explain why you are seeing this generic 500 error message. Take a look at the Event Log (eventvwr.msc) of the server which might contain additional information about the error. There could really be lots of possible reasons (.NET framework misconfiguration, application pool or virtual directory misconfiguration, missing access rights to some folders, ...)
That's the reason why you should have a staging server which has the same configuration as your production server - it would allow you to test your configuration before shipping.
Change IIS Error Pages feature settings to "Detailed errors" or try to run the app from the server where it's deployed.
If the error page is coming from IIS because of some configuration being incorrect, you can try using Failed Request Tracing.

Categories

Resources