ASP.NET application blocked after one blocking request - asp.net

We have an ASP.NET app running on a Azure Windows Server 2012 R2 VM with IIS 8. All settings are pretty much default.
Our app runs on two web application. One for the frontend (MVC) and one for the API (Web API). Both use the DefaultAppPool.
Today one Web API request had a SQL server call that didn't return until the timeout (that SQL server was offline). But funny enough, all other calls to our Web API project also seemed blocked after that. We might have about 50 users on our website and maybe 5 users made a call to this blocking method at the same time.
So I'm a bit confused to why all other requests were also blocked. The request to the MVC frontend were not blocked. Even though it's using the same thread pool.
Reading the discussions about thread pools on IIS, I think we should have enough threads to handle a situation like this?
asp.net Thread-pool max threads - clarification?
What am I missing here?

Related

What exactly are Azure website instance

Azure website clarity regarding the instances, are these instances running on multiple machine like a web server farm environment where one client request (session) can be server by different server in the farm.
Issue with server farm asp.net application is that we can loose session variable if that is the case, for this issue to get around we add machine key in web.config that assure client session will always be server by same server so there wont be any lose of session variable.
How does Azure instance work. doesnt it mean we can have 10 websites under same plan let ex s1 Standard.
I am hosting asp.net webform based website on Azure I am confused how exactly instance work. there are lot of article on internet to create confusion.
The thing with PaaS is that you don't have to care about that. If you have a statefull site, you can use the ARR Affinity setting to ensure a client gets always to the same instance:
Adding to Martin Brandl's answer.
An App Service Plan can have multiple instances. These instances run all of the apps in that plan. So it is pretty much like a classic web farm. Except it is way easier to manage.
There is a better way of keeping session information in a web farm rather than relying on sticky sessions with ARR Affinity. Put the session data in a central place. For that you can use Azure Redis Cache or SQL Database. There are ready-made session state providers for these that you can just plug in to an ASP.NET application. That way your session state is not stored on the instances, so you don't need to care if clients hit the same server.
The problem I have with ARR Affinity, is that Azure does not guarantee your instances will remain running. A hardware failure could bring one down and you lose a part of your session data. If you use auto-scale, same thing.

Azure Webapp - Receiving 502 page error

I have a web site deployed under App Services of Azure. It is working well up to couple of days before. But since two days Iam receiving below error
502 - Web server received an invalid response while acting as a gateway or proxy server.
There is a problem with the page you are looking for, and it cannot be displayed. When the Web server (while acting as a gateway or proxy) contacted the upstream content server, it received an invalid response from the content server.
When I access Site with xyz.azurewebsites.net it doesn't show this error. This is only displayed when I access with custom domain name. I have enabled Failure Request Tracing, but FREB logs doesn't show any 502 errors.
Can anyone help me understand what's the issue is?
Thanks
Azure WebApps have ARR sever (aka the FrontEnd) in front of the actual machines serving the web applications (known as the workers) and HTTP 502 is returned via the FrontEnd servers typically under these conditions
The request is taking a really long time on the actual worker
machine to execute
The worker process corresponding to the web
application is not even running or crashing multiple times.
Since the HTTP 502 error is happening on the FrontEnd servers, you won’t see these in the IIS logs because the IIS logs are of the worker so basically in your case either the request is taking too long to execute or the worker process serving the request (on the actual worker machine) is crashing.
As you mentioned that things work when you access the site over a custom domain vs xyz.azurewebsites.net then I would suggest checking a few things.
Make sure that your custom domain is really resolving to the right xyz.azurewebsites.net. Try using www.digwebinterface.com and put your custom domain there and make sure that it resolves to xyz.azurewebsites.net
Check if by any chance your code does something special for requests which arrive on your custom domain. Meaning any special processing like database lookups, or URLRewrite rules getting triggered etc. for requests only to custom domains.
Also check in your FREB logs to see if you can spot any long running requests when the hostname contains custom domain. You can use the FREB Viewer under the Support Portal for your WebApp to check this easily
Check if the WebApp is crashing by going to the EventViewer under the Support Portal for your WebApp and see if there are any crash related events.
You can reach the support portal of your WebApp by going to https://xyz.scm.azurewebsites.net/Support (where xyz is name of your Azure WebApp)
If this doesn’t help, then I recommend engaging Microsoft Support as they can check some of these things easily at their end.

ASP.NET Client Proxy for IntelliTrace and Test Impact slowing down test execution in Test Manager

I am using Microsoft Test Manager to run my automated tests written with selenium.
I want to be able to know what tests I should run after a code changes. To do so, I have enabled the "Test Impact" adapter on my test settings. After a week i realized that it was not working, and after reading a lot on internet I found out that I should enable also the ASP.NET Client Proxy for IntelliTrace for the Test Impact adapter to work.
But now I am completely lost. There are 2 places where I can enable this adapter: at the Web Client role and at the Web Server role. The Test Adapter can so be enabled in both roles. That is what I did:
I enabled nothing at the Web Client role.
And here comes my questions:
1 - In which role should I enable the ASP.NET Client Proxy for IntelliTrace and the Test Impact role?
2 - Why does the Web Server and Web Client role have the same adapters and how can I know in which one I should enable an adapter?
3 - When I enabled the ASP.NET Client Proxy for IntelliTrace (it does not matter in which role I do) it slows down my test execution a lot in a point that the test times out because my ASP app does not respond any page at all or takes too much time to respond. If I disable this adapter, everything works fine. I presume that this adapter is injecting some service on the IIS Server and that is why it slows down the requests, but I have no idea why.
I am testing an ASP.net application, MS Test Manager 2013, TFS 2013 and the latest version of Selenium

Use a Windows WCF Service in asp.net application

I am new to the WCF model, but I have created a service, that seems to work in VS2010
Now I would like to access this windows service from an asp.net application. The reason behind this is: I want to be able to call the service to connect via SSH to a server, and keep that connection open (as I did in a Windows Forms app)
Any ideas on how to go about doing this? I tried it with an IIS hosted service, but the connection is lost each time the request finishes.
At least in VS2010 with the tester, I can invoke my connect function, then invoke other functions to query data, then disconnect.
FYI, the local Windows Service and IIS are on the same box.
WCF services by default create a new instance for each request. There are other models, although I'm not sure they will manage as long running a process as you want. This article has some good info on managing sessions: http://msdn.microsoft.com/en-us/magazine/cc163590.aspx
Alternatively, why not use a technology like workflow foundation, that was designed to run / persist / re-awaken long-running processes? http://msdn.microsoft.com/en-us/library/ee342461.aspx

"NT AUTHORITY\ANONYMOUS LOGON" error in Windows 7 (ASP.NET & Web Service)

I have an asp.net web app which works fine in Windows XP machine in a domain. I am porting it to a Windows 7 stand alone machine. The app uses a web service which makes a call to sql server. The web server (IIS 7.5) and SQL Server are on the same stand alone machine.
I enabled Windows authentication for the website and web service. The web service uses a trusted connection connection string. The web service credentials uses System.Net.CredentialCache.DefaultCredentials. I noticed username, password and domainname are blank after the call! The webservice and web site use the 'Classic .NET AppPool' with NetworkServices identity.
I am getting an exception "NT AUTHORITY\ANONYMOUS LOGON" in the database call in the web service. I am assuming it's related to the blank credentials.
I am expecting ASPNET user to be the security token to the database. Why is this not happening? Did I miss a setting?
(Usually this happens when sql server and web server are on two different machines in a domain, delegation & double hopping, but in my case everything is on a dev box)
It sounds like you're experiencing the "double hop" problem. It basically means that you're not allowed to forward the clients privileges to a third party, usually a sql server on another machine.
I've answered this before, perhaps that answer will help you further.
Your problem seems to be related to the web service passing the correct credentials to SQL server.
There are a few layers of security for you to check. But the first and easiest is to make sure you have disabled any security other than Windows Integrated. IIS will always use the simplest security protocol. So if you have Anonymous and Windows Integrated enabled then you web site will always choose Anonymous.
Next each site in IIS7+ runs under an app pool which can have separate security. Then under all that the IIS Windows Service runs under a specific account.
Buy default you shouldn't really have much problem with app pool and IIS security as it pretty much works out of the box, but it's worth checking.
One more thing I would check is the named pipes in SQL. My knowledge isn't vast but I know that named pipes can be used for communication on the same server between various applications, IIS and SQL being two of them.
If names pipes is disabled through the SQL configuration manager then I would have expected a different error, but it's worth enabling.
Hope this helps.
Mike

Resources