how to resolve runtime error in asp.net while hosting website - asp.net

i done my work on local. All pages of aspx is working properly but when i upload my website to remote server. i face this error ....
Runtime Error
Description: Failure of an application on the server. For security reasons, the current custom settings to prevent application failures remotely view more details about the error encountered. These details can be displayed in the browser but run locally on the server.
Details: To enable the display of the details of this specific error message on the remote server, create a tag in a configuration file "web.config" in the root directory of the current web. The "mode" attribute of the tag must be set to "Off".
<! - Web.Config Configuration File ->
<configuration>
<system.web>
<customErrors mode="Off"/>
</ system.web>
</ configuration>
Note: You can customize the error page by modifying the current attribute "defaultRedirect" application configuration tag to point to the URL of a custom error page.
Please tell me how can i remove this error and see my asp pages on internet browser.

You are getting some error that is not shown to you. You have to turn the customErrors mode to off or set RemoteOnly to see the error, you might be getting exception while accessing database. Once you know the error you can fix that error and set the mode to On again in customErrors tag in web.config.
<customErrors defaultRedirect="url" mode="Off">
 <error statusCode="500" redirect="InternalError.htm"/>
</customErrors>

Related

Azure will not turn off custom errors

I'm in the process of migrating a client site to an Azure VM (stop gap until we rewrite to move to Azure Proper). The problem that I have is that there is a problem somewhere and I can't see what it is. When I run up the site I get the usual yellow screen of death...
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".
Notes: The current error page you are seeing can be replaced by a
custom error page by modifying the "defaultRedirect" attribute of the
application's configuration tag to point to a custom
error page URL.
I have had this many times before in such situations, so I edited the web.config file to look like this...
<system.web>
<customErrors mode="Off" />
(other stuff)
</system.web>
... and the same message came up. I recycled the app pool and even restarted IIS but I still get the same message, it's as if the VM just doesn't care what I put in the config file.
I've added 'localhost' to the bindings so I can view it on the server directly and I get this instead...
Configuration Error
Description: An error occurred during the processing of a
configuration file required to service this request. Please review the
specific error details below and modify your configuration file
appropriately.
Parser Error Message: An error occurred loading a configuration file:
Directory 'C:\inetpub\wwwroot\test.siansplan.com\config' does not
exist. Failed to start monitoring file changes.
Source Error:
[No relevant source lines]
Source File: C:\inetpub\wwwroot\test.siansplan.com\web.config Line:
0
Version Information: Microsoft .NET Framework Version:4.0.30319;
ASP.NET Version:4.0.30319.18447
Has anyone else come up against this before?
I'm at a loss what to do.
I found the answer to this one. The web.config file was referencing a child file which wasn't present. This is quite a gotcha if you can't use localhost based debugging.
Your system.web tag is not properly closed:
<system.web>
<customErrors mode="Off" />
(other stuff)
</ system.web>
Should be:
<system.web>
<customErrors mode="Off" />
(other stuff)
</system.web>

Runtime Error don't know at ALL what to do i have no experience with these things

Who can help me with this?? I don't know what the hell to do at all. From begining to end I don't even know how to create a tag or nothing. help me? asap this is how it looks:
Server Error in '/HRX' 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".
Server Error in '/HRX' 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 <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
If you have remote access to the server then try to browse the page on the server locally.
Otherwise try to set customerrors mode to "Off" and deploy it.
<customErrors mode="Off"/>
If you do either way you will hopefully see a Exception StackTrace instead. That will probably give you a better clue of what that is wrong.
In addition to what others have said, it helps to install some sort of error handling capabilities. For a nearly plug and play solution, look into ELMAH (which can be installed easily with NUGET). This keeps a database of all the unhandled exceptions in your ASP.NET site and can even email you the error details when a problem is encountered.
Also, you'll want to set up a custom error page that explains to your users an unexpected error has occurred. This looks much more professional.

HTML & ASPX Link Issue

I've recentley moved my entire website from the root directory into a secure folder, but when I try to access it I now get a error: 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".
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's configuration tag to point to a custom error page URL.
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
Does anyone know what I'm doing wrong?
Set it to off to view the error (only if it's on a staging, non-production server). Remove the custom error page to see what's going on. Try and re-create the error on your dev machine first. You also have the option of logging or emailing the error stack to yourself.
Instead of moving the entire site to a "secure folder", implement some form of authentication for the pages you wish to protect.

asp.net Debug server remotely

I keep getting this when I try hit the link of a website I just deployed to the web host's server:
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.
It Suggests I set the following in my web.config file so I can see details of the error:
The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's configuration tag to point to a custom error page URL.
So I have added the following to my webconfig file and created a mycustompage.htm relative to the web.config file:
<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
My mycustompage.htm is empty, is there anything I should add in there? When I try hit the link now all I get is a blank page after the server tries to redirect to mycustompage.htm.
Depending on what you're trying to accomplish:
1) You want to view the actual error information.
In this case, remove the defaultRedirect attribute and change mode to Off. Custom errors intercept the standard Yellow Screen of Death (YSOD) ASP.NET error page. By setting Custom errors to Off, the YSOD error message will be visible to both local and remote clients (all remote users will see the error details).
<configuration>
<system.web>
<customErrors mode="Off" />
</system.web>
</configuration>
2) You want to build a custom error page to handle how your application responds to error conditions.
In this case, you might edit the mycustompage.htm to display a friendly "An error has occurred" message rather than seeing the default Custom Errors are not enabled message.
Link here for reference.

Runtime Error in asp.net?(online )

I develop a web application it is working fine in local.
When i upload the site in online through CuteFTP it is showing the error like this...
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".
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
please help me i place the but even though it is not working it is giving same error. Thank you
Did you create a custom errors section in your web.config? See here for more details: http://msdn.microsoft.com/en-us/library/h0hfz6fc(VS.71).aspx
As the error message says you need to set this to "Off" to see errors remotely.
You could also look at the event logs on the server for clues.
If you have remote desktop access to the server you can try logging on there and connecting to localhost and see what that tells you.
"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"."
Try this and check what the error is.
If you can't, run the application from the server (using a remote desktop tool)..
If you can't, add a try catch that writes the exception to a text file.
The message says "something happened but I am not allowed to show the error. Do this to see the error". So make those changes and try again.
EDIT
Your answer to your question (by the way: it would be clearer to edit the question itself) suggests that you want to write to some directory. On your development system, that worked because then the webapp ran under your own account. On the server the webapp runs under the specified accounts.
So: find the directory where you want to write to, and give the correct account "write" rights there.

Resources