ASP.NET application pool shutdown problem - exception

Sometimes an exception causes application pool to shutdown. I start it manually but the question is how can I automate this behavior in IIS 7.0 (Windows server 2008).

If an application pool dies, the next request for a resource served by that pool will automatically restart it. If, however, you have rapid fail protection enabled on the app pool, and the pool dies more times than the number specified by the maximum failures property within the interval specified by the failure interval property, then you will receive a 503 Service Unavailable message. At this point, you will have to manually restart the app pool.
To work around this, either disable rapid fail protection for the app pool, or try increasing the number of faults within the time period, and then determine the root cause of the exceptions which are terminating the app pool.

open iis select your website and on right hand side u see Actions
under Browse Web site -> Advanced Setting
select start Automatically to true.

I am having a similar problem in Windows Server 2012 Standard and IIS 8. URLs with an ampersand character at the end cause IIS to freak out, and consider them malicious. This causes the App Pool to fail, crashing the website.
What you need to do is watch the Event Viewer for 1309 events. (In the Event ID column) You can set this up using Task Scheduler. When you see the event, you restart the App Pool.
To restart the App Pool, you can use a .vbs script like this:
Set oWebAdmin = GetObject("winmgmts:root\WebAdministration")
Set oAppPool = oWebAdmin.Get("ApplicationPool.Name='DefaultAppPool'")
' Recycle the application pool.
oAppPool.Recycle
Or you could use Powershell if you like that better.
I use a pretty neat C# program that I found here:
http://www.west-wind.com/weblog/posts/2012/Oct/02/A-tiny-Utility-to-recycle-an-IIS-Application-Pool
It does a great job, and seems to get around some of the permissions issues that the previous two methods have. I do have to run this script as an admin, though.
Hope this helps. It does not solve the problem, but it will take the heat off until there is a solution to this URL issue.

Related

Next js creates different mysql connection pools if behind nginx

this is my first question, hope I do it right!
I'm actually working on a Centos server with nginx as reverse proxy and a NextJs web application.
Until now I've made a single connection for every query to my db, but I want to switch to pool connection to my DB (with npm module mysql2), but apparently there's something I'm missing...
If I run my application local, or on the server without nginx, with yarn start, it opens just one pool (I can see them by running the query SHOW PROCESSLIST on the DB in use). But in the moment I add nginx as reverse proxy, every request my app receives opens a pool and the latter never gets closed or called again (apart from the one pool opened if someone visits the page for which I use the nextjs function router.push(/url)).
It happens also if I run yarn dev: it opens a connection pool for every new page next has to build in development or if I make some changes to pages and save. But this behaviour I understand.
The nginx configuration is a normal configuration, and everything works fine.
I've surfed the web far and wide, but didn't find anything that could help me understand what could be going on between nginx-next-mysqldb, and no one reported any problem whatsoever. Is this how it's supposed to be or there's something that I should do to make it work?
Oops... my bad...
Transitioning from single db connections to pool, I left a function which made a single connection, which I was not closing.
So there's no problem and nothing to uncover behind nginx-next-mysql.
Don't know if anyone will stumble upon this problem, ever, but, just make sure you don't have any single connection to your db... And make sure to close them :)

Chrome - Disabling Web Sockets or Closing a Web Socket Connection?

Is there any way to disable web socket connections or end a web socket connection through Chrome's developer tools network tab?
I've noticed that turning throttling under the network tab to Offline doesn't affect web socket connections that have already been established. It only prevents traditional HTTP requests from going out.
There's a question here related to this, but it's woefully outdated.
February 2022 update
As of Chrome 99 this is supported: https://developer.chrome.com/blog/new-in-devtools-99/#websocket
Original answer
No, there is no way to disable or close a connection from the Network panel. Source: DevTools Engineer.
If you have a reference to the WS connection, though, you can close it via the Console using its JS API.
You can close idle and flush your inactive socket pools in the Net Internals page in Chrome. However, this unfortunately only closes your active sockets by the looks of it.
chrome://net-internals/#sockets
You would have to use the WebSockets API and call close() on a reference to an existing socket to close it explicitly. Otherwise, killing the process with the active socket is all I can think of.
I assume you want to test unexpected connection failures, it is possible, but not through Network-tab and you need to be able to log from code.
You can close Websocket connections if you are able to use console.dir(socket) even when you could not store the connection reference, e.g. due sandboxing. Via console.dir() you are able to gain a reference to the socket by right clicking the console.dir() output of the websocket and choosing "Store object as global variable". Then call close() on the temporary reference and the connection you want to terminate closes.

IIS occasionally no response

I'm facing a problem with a 3-tier application. It uses IIS and SQL Server. And the problem is that sometimes (longer requests cause higher probability) client does not receive response from IIS. It hangs when there is no activity ON SQL Server, and when even when I kill an SQL Process I get no response with an exception. When I examine data after these hangs I find that my SQL requests have succeeded, so the problem appears to be on IIS. Unfotunately I don't have much control over the place where the application is hosted and I cannot reproduce the problem. There can be many answers to this question, but at least I need a hint in what direction I should investigate.
UPDATE: I also have an app running on the same server that does a small job: it inserts around a 100 lines line-by-line into a database. Artificially I made it run for about 10 minutes (by putting xlock on the table). After removing the xlock the process on IIS continued running and successfully inserted those 100 lines. However, control never returned to the client thereafter, it just waited indefinitely. It looks like this is a problem when returning a response to the client after a long running process.
BTW, this is not a website, but a WinForms app that uses Remoting.
If you're sure that SQL Server is returning to IIS, then you might want to check the IIS logs to see what might be happening to the request. The normal location for these logs is %SystemRoot%\system32\Logfiles\<service_name>.
If you're not sure about SQL Server, you might access the SQL logs, run Profiler, or check the Windows system logs for errors, run your site in debug in Visual Studio or add your own logging to your app to figure out which step it's hanging on.
I have finally figured out where the problem is. The application is run on a web farm and there is a balancer server between the client and IIS. There was a too small timeout on the balancer. For some reason it is not quite friendly with .net remoting and it doesn't return any timeout exceptions to the client. The issue has been solved by increasing the timeout.

SQL Server Web Synchronization - replisapi?diag won't run - just tries to download

I'm trying to set up SQL Server 2008 Web synchronisation between 2 servers, and am following the instructions step by step on MSDN, here: http://technet.microsoft.com/en-us/library/ff714039.aspx
All has gone fine, until I get to the section "Testing the Connection to replisapi.dll
" - when I go to https://my-server-name/sqlreplication/replisapi.dll?diag, I get a user name and password prompt, which is fine, and a 'There is a problem with this website's security certificate', which I expect, as I'm using a self-signed certificate during development.
Next though, I expect to see a diagnostics page, but instead, I get the browser's generic 'Do you want to open or save replisapi' message, forcing me to either open or save it.
Does anyone know what I'm missing here?
Many thanks in advance.
The .dll file is getting downloaded?
This happened to me before. I had to repair my IIS mappings using the Aspnet_regiis.exe utility. After running this utility I was able to view the diagnostics page.
http://www.idautomation.com/kb/aspx_error.html
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q306005&GSSNB=1
Hope this helps.
Issue: 32 bit applications are disabled in your App pool.
Solution: To resolve the issue click on Application pools, right click on your Application Pool and select Advance Settings. Set "Enable 32 bit Applications" to be "True". Lastly "Stop" and "Start" Application Pool Tasks.

IIS 7.0 ASP.Net 3.5 Application fails when multiple users log on

I have an ASP.Net 3.5 Application hosted on Windows Server 2008 machine using IIS 7. There is a seperate application pool for this application.
The problem I have is that as soon as 2-3 users access website simultaneously, it starts throwing exceptions on almost any task performed say e.g. an exception during logging in the user using built in aspnet_membership. The same things work fine when there is only one user using it.
Any suggestions what things I need to test for?
Thanks,
Ali
I had some problem like this for some web-application, but in my case I was using IIS 6.0. After analyzing the application by means of some DevPartner tools for analyzing memory usage we realize that some components were consuming excessive resources, by replacing the toolkit we were using for simple .Net controls the applications stop crashing. Most of the crashes are due to problems in code. Also check the web config in the following points: sessionState, authentication. Disable custom errors (customErrors) to view the error details. See the application event's log to check the error description.
The first thing I do when setting up a website of this nature is to uncouple the session state from InProc to StateServer. Oftentimes I find that an application recycle or even an application level exception can cause the w3wp.exe process to crash and reload which dumps session errors. As with #Arce Brito's recommendation, you should do everything you can to find the root cause of the exception as decoupling the session will really only mask the symptom.