Archive for March, 2007

March 9, 2007

"Server Error in ‘/application name’ Application"

You may receive the Error Message “Server Error in ‘/application name’ Application” while browsing an asp.net application.

You may receive the following error message while browsing an asp.net application.

“Server Error in ‘/application name’ Application
————————————————

Runtime Error Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Details: To enable the details of this specific error message to be viewable on remote machines, please create a tag within a “web.config” configuration file located in the root directory of the current web application. This tag should then have its “mode” attribute set to “Off”.

This error might occur due to two scenarios.

1. There is an error in the application’s logic with the inputformat, Type etc., and you have set the Custom Error Mode in the web.config to “On” and not specified a default redirect error page.

2. The web.config file is not well formed or having invalid characters and the application is not able to pick up the settings from the same.

Solution

1. Set the custom error mode to “Off” to view the error.
After rectifying it and before deployment, change it to “On” and specify a default error page, as follows:-



such that your users will not be able to see the actual error and get your friendly error page where you can politely say “An error has occured! Contact the Application Help Support …” .

2. If the above solution is not working (i.e. even after setting the custom error mode to On, the same “Server Error” occurs, then the likely chance is that your web.config file is not well formed and has invalid characters etc.,

To resolve, it copy paste the contents of the file to a notepad, save it as an xml file and try to browse the xml file in the browser. If the xml file is unable to be rendered by the browser and throws error, then you can find the place where the tags are not well formed or invalid character(s) exist and rectify them.

Things worth noting is Web.config is case sensitive (off, oFF,..etc) and even trailing/leading spaces can cause the above error.

you will encounter the same problem at the time of hosting a website to a remote webserver. Eventhough once you have change the web.conf you will get that above message.

solution is to check whether is to make sure that you have given appropriate/suitable permission to the folders like App_Data & to double check the .NET version.

hope all you guys can learn something about the above problem.

🙂