I have two ASP.NET websites hosted on a server and connecting to the SQL database on on different server.
One of the website throwing 500 internal server errors (as custom error mode on in production). I am not sure what is causing these errors. And these errors are random, so I am not able replicate on dev environment. Both website having almost similar functionality but I am facing these errors only in one website. Recently there so many time out errors. So I asked the system admins to check the event log then they said lot of windows updates are pending, so they ran patch and rebooted both application and database servers.
After that I am getting 500 internal errors while going from login to default page in the website but I am sure there nothing wrong with code and these errors not caught in the application_error event in the global ascx file.
Any insights on how to troubleshoot this issue further?
Error 500 is very generic error. AFAIK when it happens an application pool of the application is 'killed'. It can be caused for instance by infinite recurrence (stack overflow).
To be honest it's impossible to tell you why this error occurs on your environment, but my advice for you is following: configure some logging system, there's a chance that it will log what causes an error before application pool will 'die'.
I strongly recommend ELMAH. It's a great tool and very easy to configure. If it won't help you should implement writing log messages in some important places of your application so you can target what module/class/method causes problem.
Here you can find a bunch of information about ELMAH:
https://www.stormconsultancy.co.uk/blog/development/tools-plugins/getting-started-with-elmah-asp-net-error-logging-and-reporting/
http://www.asp.net/web-forms/overview/older-versions-getting-started/deploying-web-site-projects/logging-error-details-with-elmah-cs
https://dillieodigital.wordpress.com/2011/03/30/elmah-a-quick-start-tutorial-and-guide/
Related
I am having a problem with my application. The application works perfect on my development machine. It fails, without any errors on the live server. The page loads, but the code doesn't execute apparently.
I have been stuck on this for a while because I can't figure out how to get any information on the problem. There are no errors, so my custom errors settings in web.config are not helping.
I looked around online and I heard there was some remote debugging tool. The article was from .Net 1.0. I tried to follow it, but its not going to work because I am using a shared server. I do not have permissions to start the remote debugger on the server side.
I tried creating some output text files with variable contents, but the files are not being created either. They are created on my development machine, but never show up on the server, again with no error.
I have no idea how I'm supposed to figure out what is going on, because I'm not able to step through the code once it's on the live server.
Is there anyway to step through, or debug the code once I've published it? If I spent the extra money on a VPS, would that allow me to debug on the server side? I'm assuming I could just install Visual Studio on the VPS and step through the program. I've never used a VPS before.
Unless you do something very special in your code, it is unlikely that it behaves differently on your server compared to your workstation.
It is more likely that the configuration on the server is not correct.
You are saying your
code doesn't execute
How do you know that? You should first confirm that your code is actually executing.
you are also saying:
it is now directing me to a page that says "Directory Not Found"
a web server it never looking for directories, it is looking for resources, check your iis http logs what substatus codes are you getting?, enable Failed Request Tracing and review the logs.
Using Process Monitor can also help determine what the web server is doing.
Start with a very simple page and see whether that executes fine.
What I'm saying is, first debug/fix the execution environment before trying to debug your code.
You would never install Visual Studio on a server, the default installation of a Windows Server doesn't even allow you to install it. Instead you can use remote debugging components on the server and use your local Visual Studio to debug remotely.
When I get a call there was an error in our web application when running on a windows server I would simply go to Windows Logs and scroll down the application logs and find the Warning. Easy to read and made it quick to solve the problem.
Now I'm testing out Azure Websites to run asp.net applications and i'm racking my brain trying to figure out how to have the same kind of quick error find a fix process.
Viewing the application logging in Azure's application diagnostics is utterly useless.
It would take me forever to dig through those logs. rewriting the application to handle errors differently is not an option for me.
So who else is having this problem? any solutions?
The easiest solution is to offload your error logs to a separate service like Raygun. This will result in a (small) monthly fee but is a 5 minute setup and you are good to go.
Otherwise you can go and use Log4net to log your error to the blob storage but then you will have to poll that one for your logs.
Try the Azure Website Log Browser site extension, you can install it from the new Azure Portal on your website (as a site extension) and it makes it easier to view all of your logs.
Read more about it here.
We recently ran into a situation where a bungled web.config deployment resulted in two 'appSettings' sections in our web.config. We've got detailed error shut off (it's prod) and so in the browser we saw a generic 500 error. Checking Windows application log revealed nothing.
Is it possible to set up some kind of alerting for a case like this? Something (anything!) logged to the Windows application log would be ideal.
Thanks for looking!
You can add an error logging module to help you debug your application. I found ELMAH to be a very good tool. Here's how you log errors using ELMAH.
ELMAH can help you debug your application in the future. Whenever you make changes to your application, test it before publishing the changes. A good way of doing it would be to set up a Staging environment to match the Production server. That way you would be able to see any errors before moving the changes to your live application.
We have an ASP.net web service (.asmx) up on our server that one of our clients uses to get data from us.
They've been complaining about timeout issues occurring now and then. I decided to check out my code to see if anything could be causing the issue.
I went to our .asmx url using my internet explorer and saw that it just kept loading. This is the second time that I've noticed this happen. I just can't connect to the .asmx page. I get no error message, just keeps loading.
Now obviously, this would cause timeout errors for their client program as the service is unreachable. Any idea why this could be happening??
Also, where are the asp.net error logs usually stored on the server??? Is it in the same directory as the .asmx?? And do these error logs get generated automatically or do I have to put something in my code??
EDIT: Forgot to mention that the server where my web service resides is a Linux based server. I had to use MonoDevelop to package it for such.
Look at the application event viewer on the server. If any errors are occuring at the service level, you'll see them posted there. Timeout processes can be tricky to debug. If there are server resources that are being vied for by other application pools, this application might be getting the shaft. I would look at process usage of memory and cpu at the server first. If all looks well there, check into IIS and see what other applications reside with your service. If it is all good there, then I would look into your code for long running possibilities.
I have implemented localisation on my web application using meta:resourcekey and GetLocalResourceObject with App_LocalResources for user controls, pages etc. everything worked perfectly during testing however when copied to our live server I get:
InvalidOperationException: The resource class for this page was not found. Please check if the resource file exists and try again.
I have checked and the files are exactly where they are on my development machine, where I am testing using IIS 7. The server also uses IIS 7. The website is running on .Net 4 .
I have done some research and found some answers:
Moving to global resources
apparently may fix the problem: I
cannot do this, as I have many pages.
It is impractical
There is a hotfix available for .net 2.0, however I am
using .Net 4.0 :
http://support.microsoft.com/kb/933383
. This bug is caused by the resource
files being changed while the
application is running, but
recompilation occurs on the aspx
pages, bringing them out of sync. I
have not changed my resource files
since publishing.
The live server is clustered. This error showed up in my exception logs. I have not experienced a crash on the application, which indicates that either the system is contuining on despite the exception, or I am simply not being directed to the cluster which has this error. I have checked and it seems that only one cluster is reporting the error, although this could also mean that the load balancing server has not chosen the other cluster for users.
Has anyone experienced anything similar and how did you solve the problem?
There was a missing AppLocal resources folder in my project. What threw me off was that the error occured on the page and not the user control. Careful investigation of the stack trace was all that was needed.