Very weird IIS6 asp.net website behaviour - asp.net

I have a weird issue with my website. This is asp.net(.net 3.5) website hosted on a dedicated server IIS6.
Recently I got a strange behavior, the website hangs and just doesn’t reply unless I go to iis and restart either app pool or whole IIS - BUT what is the most strange thing is that in case I go to remote desktop of the server and try to access it locally it DOES work just fine.
I read couple threads about deadlocking and hanging because of memory leaks and non closed sql connections BUT why it still does work from the local?
In case there is something wrong with the code – why does it still work from locally?
In case there is some issues on the hosting side (like firewall issues) then why does iisreset help?
Any thoughts would be appreciated. Thank you!

We've just run into this problem, and we have a solution. IIS has two thread pools to handle requests. One thread pool is used for external requests. Another pool is used for local requests. Our problem was caused by a deadlock in backend code. Once the deadlock occurred, all external requests were queued but not serviced because all of the servicing threads were in use. Opening the website from the web server uses the other thread pool, so the requests are serviced. We were absolutley positive it was a network issue, but WinDbg proved otherwise.
See here for more information:
MSDN blog entry about IIS and threads
minLocalRequestFreeThreads
(Also, search for minFreeThreads to see the non-local request thread pools.)
Good luck!

Are you sure that the website hangs for all external users, so that it's not just one single user?
The IIS only runs one page at a time for each user, so if one request is caught in an eternal loop, that single user will experience that the server has stopped completely as no pages at all work until that page times out. The server will still work as usual for other users.
You can test this by using a different browser, or starting a new instance of the same browser (possible with IE, not with Firefox).

Hmm not enough info to really give you an answer, but I would look at your firewall first if it responds locally from the server. Do you have another server behind the FW like a SQL server? Try browsing from that as it will show you where the problem is.
My though would be a badly configured load balancer.

Related

.Net core application failing to upload via FTP, hosted on IIS

I have a problem deploying a .net core application via FTP which is hosted on IIS.
The main DLLs (core application) that I want to update just wont upload, FTP just gives me a generic permission error message. I think the reason is because they are in use because then I stop the application pool, upload and restart it works just fine.
But this isn't really a solution, are there any other methods of publishing that will alleviate this problem?
Edit:
"open for write: failure"
Is the only error I'm getting. I can't find anything online and the only solution I have is restart the app pool.
I found an answer and I figured it should be here for future Googling.
The issue is as I first expected IIS proxies the request to kestrel and that means the process is in use as far as Windows is concerned. There are three solutions.
The Good Solution
Have two (or more) VMs on azure behind a load balancer. Have a script which turns off the sites one at a time, does what it needs to do and turns them back on. Do this right and no downtime!
Intermission
Before I talk about the other solutions a little explanation. I have not been working with .NET for a long time but apparently there was this thing you could do where you add a app_offline.htm and it will temporarily take down the site for you.
In the context of IIS and .Net Core it also releases the process, which is really useful as it solves my problem! Although I had to visit the web page first for it to take effect, unless I'm mistaken.
The Bad Solution
Use an automated script to rename _app_offline.htm to app_offline.htm. Do the upgrade and then revert that change. Takes your site down, kind of ugly but scripting is always better than...
The Ugly Solution
You only have access to FTP, no remote admin or proper deployment process because... reasons.
Upload an app_offline.htm, upload as little as possible and hope it doesn't break anything before deleting or renaming app_offline.htm.
Also you would have to perform any DB migrations by using EnableAutomaticMigrations = true because you have no server access or scripting methods.

ASP.net web service on server sometimes doesn't load

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.

asp.net mvc 2 website MUCH slower on IIS 7.5 vs built-in server

I am taking some time to learn how to develop asp.net mvc2 websites, but I'm used to working directly off IIS instead of the built-in web server that uses the random ports when you hit F5.
but I've noticed that using the built-in webserver, requests fly and are immediate. I am using only the default project with the Home and About pages as it comes out of the New ASP.NET MVC 2 Project settings, no database connections, nothing beyond the base install...
but when I setup the IIS website and pointed it to the same directory, each request takes at least 3-5 seconds to complete, sometimes more.
this isn't just the "load" on the first request. EVERY request takes this long on IIS.
but if I F5 and test the project once again, everything zips and the responses are immediate.
What might i have configured incorrectly?
this is on win7 x64 by the way
You can check with a tool like firebug what takes the longest time in the request. If you use firebug it will tell you which part of the request cycles takes a certain amount of time. (I once used this when I encountered problems with the localhost URL, Firebug told me that the DNS request took about 2 seconds while using 127.0.0.1 took 1ms (using google I found out that was an issue due to ipv6 enabled)). So try tracing the requests with Firebug.
If the request to IIS is performed quite fast and the browser is waiting for a response for a long time it must be in the handling of IIS (the built-in server and IIS are different). In that case you can try reinstalling IIS (to make sure no plugins or other data is in IIS making the site slower) by removing and adding IIS via the windows components.
If that still doesn't solve the problem try tracing on the application via the built-in tracing capabilities of ASP.NET (http://msdn.microsoft.com/en-us/library/wwh16c6c.aspx)

I see "Server Application Unavailable" with IIS 5.1

alt text http://img822.imageshack.us/img822/2488/79392512.jpg
I shared maximum permissions there and there nothing in the log. I can't understand where this error comes from.
One of the reason that this may happens is because of crash of iis Admin 5.1. This happens a lot especial if you programming and make difficult thinks, or just a bad loop on your program can make this happens.
How to solve this.
on your website properties on Connections UNCHECK http Keep-Alives Enable.
restart the IIS Admin (and not only the "world wide web publishing") when you have problems.
Use the Process Explorer and check the iis admin and the www service that is running and not stack.
If any of this services has stack, then kill it from Process Explorer and then make IIS Admin restart.
When you restart IIS Admin, then the www is restarting also, but if fails to restart for sure you need to kill it with Process Explorer.
Hope this helps.
I seen usually with the mix of .Net versions deployed in IIS (ASP.Net).
Just ensure one is there.
if you have later versions of IIS then you can segregate different versions with the different worker process.
Hope it gives you some clue..

NLB and Web Deploy

I have two webservers in a cluster serving a web application.
Using MS Web Deploy to push a new version of the application to one server, and then again to synchronize the files to the other server in the cluster. It seems to be the most ordinary thing to do.
But wouldn't there be a problemm, when one server is deployed with the new version, and the other is not yet finished. Will it not cause troubles, when a page loaded with the new version makes a webservice request and the balancer sends the request to the server with the old version?
What's the best way to avoid this?
I thought about scripting a drainstop of the server, that we deploy to, and make sure only one server is running at a time. But I can't find anyone else, who seems to have written about such a solution. And guess that it doesn't scale very well too.
Another solution could be to shut down all servers when updating. But that doesn't seems very clever.
Any suggestions?
You could use DFS so that the files are basically instantly copied over to the other server(s).
Also, you could edit the host files of each server so that each server uses it's own hosted services instead of going through NLB and potentially going to another server. There is rarely a reason to go to another server when you are already on a server, it only causes headaches like you mentioned and decreases performance.
Now there is also the Web Farm Framework: http://weblogs.asp.net/scottgu/archive/2010/09/08/introducing-the-microsoft-web-farm-framework.aspx

Resources