<p>
i have deployed a web application on IIS 7 (windows 2008 r2 server)
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.

sometimes i get this error

and sometimes i get
Object reference not set to an instance of an object.
Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


but the same application on the same system when executed from visual studio works fine

</p>