ASP.NET Webapplication unavailable on Live Environment - How to troubleshoot - debugging

I have a asp.net 3.5 web application which is deployed on server 2003 and IIS 6. After running fine for a few weeks it goes "Down" and by down I mean that when I try and access it the browser looks like it's loading but never actually serves the page. After an IIS reset it loads quickly again.
My question is what are the steps and tools I should use in tracking the root cause?

First point of interest would be the event viewer, second the iis logs. If you still do not find the error then performance counters could help you out there.

Related

Visual Studio unable to start debugging

Every time I build my solution and try to start debugging, I get this message:
Unable to start debugging on the web server. The web server did not respond on a timely manner. This maybe another debugger is attached to the web server.
If I restart my IIS, I can start debugging but If I build again I have to restart my IIS again. I saw several people having same issue but no one same as mine exactly.
Open your cmd in administrator mode and run cmd
iisreset
The below link contain some useful answers:
Unable to start debugging on the web server. Could not start ASP.NET debugging VS 2010, II7, Win 7 x64
Like this answer:
1)
Try going to IIS and checking to make sure the App Pool you are using
is started. A lot of times, you will produce an error that shuts down
the app pool. You just need to right click and Start and you should be
good to go.
2) And this answer
Turns out that the culprit was the IIS Url Rewrite module. I had
defined a rule that redirected calls to Default.aspx (which was set as
the start page of the web site) to the root of the site so that I
could have a canonical home URL. However, apparently VS had a problem
with this and got confused. This problem did not happen when I was
using Helicon ISAPI_Rewrite so it didn't even occur to me to check.
I ended up creating a whole new web site from scratch and porting
projects/files over little by little into my solution and rebuilding
my web.config until I found this out! Well, at least now I have a
slightly cleaner site using .NET 4.0 (so far, hopefully I won't run
into any walls)--but what a pain!

mvc3 using windows authentication - have to restart IIS

I just finished an MVC3 project using windows authenication. Everything was working fine on my local machine however once I deployed to IIS7 it wouldn't pick up any user. But after restarting IIS everything seems to work now. Does anybody know why that is? Or am I doing something wrong?
Thanks for your help!
Sometimes you just have to restart. You probably could have gotten away with just recycling the worker process.
As for the reason, probably because you created the iis application instance without an existing web.config in there, then when you deployed your site, IIS wasn't configured to watch for changes (because the file previously didn't exist), so it didn't know about the update.

WaIISHost flatlining web-role

First off, I'm very new to Azure.
I've successfully deployed an ASP.NET MVC 3 web application to Azure, using a web role. The app uses Entity Framework and SQL Azure.
Recently I've done some changes (some including adding appsettings), and tried to upgrade the application. When upgrading, it took quite a long time, before Aborting. I've always deployed through the management portal Silverlight application at http://windows.azure.com.
When trying again to no avail, I setup remote desktop and deployed again. The remote desktop session was extremely slow, and it turned out to be because WaIISHost was putting the CPU to 100%.
The IIS Manager shows that the application is deployed and 'started', however I cannot navigate to the site in the VM, and the deployment constantly seems to be trying to update without success and eventually aborting and retrying, (as I write this, it's currently Busy and Waiting for role to start...).
Does anyone have any ideas as to what the problem could be?
I believe all the right dependencies are set to copy local, which is a possible problem. It is extremely hard to debug this issue, as the remote desktop session hangs so often due to the 100% CPU utilization, and the recycling/restarting/reupdating of the web role from time to time.
Thanks,
James
P.S. Hope some of that made at least some sense...
I doubt that there's something doing in your WebRole.OnStart and/or Run, which caused the WaIISHost uses 100% CPU. Can you remove all codes from the WebRole.OnStart and/or Run and try again.
And it might be helpful to turn on the IntelliTrace when deploying, so that you can download the trace and find out any exceptions occurred when your application started, even before the website started.

ASP.NET MVC Web Application with SQL Azure (To Do List Tutorial) -- error when deploying to production

I'm working on the following tutorial in the Windows Azure website:
https://www.windowsazure.com/en-us/develop/net/tutorials/web-app-with-sql-azure/
(also: go to windowsazure.com, click on the "Develop" heading, click on ".Net" under languages, under "Create Your First Application" -- click on ASP.NET MVC Web Application with SQL Azure)
I can run the application in the Windows Azure emulation environment on my development machine. If I change the connection strings to the production database, the app works in the local development environment.
However, when I deploy the application to Azure, I get an error message: "Sorry, an error occurred while processing your request." This appears within a rendered page, so I think the request is getting to ASP.NET.
I believe the problem I'm having is with allowing the production app on Azure to connect to the SQL Azure database.
I believe it is a firewall issue, but haven't been able to determine what the IP range needs to be. (I previously thought the problem would be with me running VS 2010 in a 32 bit environment, with Windows Azure as a 64 bit environment, but we deployed the sample app from a 64 bit environment and had the same issue). For additional details, here's my previous posting on MSDN to a previous inquiry on the same issue: http://social.msdn.microsoft.com/Forums/en-US/windowsazuretroubleshooting/thread/23afb5e3-e2ee-4444-aabb-7001ae6c6e6a/#af5284c0-ef4b-4193-b912-d4b7adfb5d21
Thanks for any assistance you can provide. I really want this sample app to work!
Update: Got the tutorial to work on a different computer and fresh 64 bit configuration, pointing to a different data center.
I got my hands on a new laptop with 64bit Windows 7 Home Premium , and installed Visual Web Developer 2010 Express, all of the most recent Azure and MVC SDKs. Seems like what I thought was a firewall issue, could have possibly been issues with database connectivity at the North Central data center. (I'm speculating, and will still need to test my original configuration against the South Central data center to see if this is actually the case. But, the North Central data center was not an available choice for hosting a SQL Azure database (3 month subscription), and here's a link to a discussion of this on another thread:
http://social.msdn.microsoft.com/Forums/da-DK/ssdsgetstarted/thread/7b181eef-ccd1-4090-80d1-0853059d166f
As mentioned above, the checkbox "Allow other Windows Azure services to access this server" needs to be checked, and both the service and the database need to be located in the same Windows Azure data center.
As #veblock suggest, you may try switching off the custom errors to see the actual error.
Meanwhile, the "IP range" that you seek for enabling firewall rule for your role is just a checkbox away:
You just need to check that "Allow other Windows Azure services to access this server" checkbox. The entry "Microsoft Services" with IP range of "0.0.0.0 - 0.0.0.0" will be automatically added. This is an internal entry and Microsoft keeps track of their own IP ranges, so that any Windows Azure data center will be able to access this SQL Azure Server.
But, yes, you can also check the real error message, by either Remote Desktopping to the instance, or by disabling the custom errors. There is a small chance that the ASP.NET MVC is also not fully installed in the Azure Instance. The easiest way to eliminate this problem would be by right clicking on the web application project and select "Add deployable dependencies", then chose ASP.NET MVC.
Thank you for your help. I have also hit this issues and spent several hours to debug what was going on since everything worked as expected in the Emulator, but won't work in production. After I have moved my hosted service and the database server to be in the same region, the problem went away.
In the original sample, it was also noted that it was important to ensure both are in the same region, but it mentioned due to performance reasons only, but for me it won't work at all.
"
IMPORTANT: Pick the same region that you choose earlier when deploying your application. This will give you the best performance.
"

WkHtmlToXSharp error on Windows Server 2008 R2 x64 environment

WkHtmlToXSharp is C# wrapper (using P/Invoke) for the excelent Html to PDF conversion library wkhtmltopdf library. https://github.com/TobiTonner/WkHtmlToXSharp
I have two websites on staging Windows Server 2008 R2 x64 environment
One of them let say web site A version of website and another one web site B.
The WkHtmlToXSharp conversion was working on the A version but when I set up an B version an conversion not working on that version, I am getting an error:
HtmlToPdf conversion failed: Failed loading page http://website/Convert (sometimes it will work just to ignore this error with --load-error-handling ignore)
I was wondering why it is happening and than I pointed A website to look in to the the same folder as B site is looking. And I was surprised that when I am running A conversion working well there, but when I am ruining B I am still getting the same error, but the funny thing is that both of sites pointed to the same source code(folder). I am just wondering why it is happend. Both websites has the similar app pool configurations and Enable 32-bit apps set too true in bot of them. Also i was trying to set the same app pool for both websites and still the same thing taking place, conversion on site A is working but on B site is not.
On my local environment(Windows 7 x64) if I set the same websites conversions working in both cases.
Also I made some changes in code to ignore the errors :
converter.ObjectSettings.Load.LoadErrorHandling = LoadErrorHandlingType.ignore;
but it is does not fix the error, only the difference is that now I am getting empty pdf in case of conversion on B web site.
I just thinking may be it is something in Windows Server which deny to run/keep in memory two copies of WkHtmlToXSharp.dll or wkhtmltopdf or something kind of like that is going on.
Maybe some one have any ideas about that?
See this https://github.com/pruiz/WkHtmlToXSharp/issues/8
The problem with IIS is that it recycles app. pools from time to time,
but during this process any non-managed resources hold by your
application may (as in this case) end up not being appropiatelly
freed. Also, having more than one AppDomain under you'r IIS
application can cause memory corruption, as both AppDomains try to
instantiante a WebKit instance under the same process (ie. same
process memory/space), and that's another no-way.
The best thing you can do is having a Daemon or Service handling
HTML2PDF conversión, and calling it from your web app. using remoting,
WS calls, or any other RPC method. This will also help you de-compose
your application and making things easier to debug.
Hope it helps.

Resources