Selectively kill a specific request under an App Pool

by Eurisko at 2013-02-06 11:55:07

I have an issue with an application that seems to have some requests hang. That’s an issue being debugged by someone else.

From my side, I want to see if there is a way to selectively kill a specfic running request but not the entire App Pool it’s running under.

I can get the items I want with : (get-item $ID).GetRequests(0).Collection and can drill down from there.

What I can’t figure out, is how to terminate specific requests under there. (I know you can do it from the console in IIS 8).

Any suggestions?

Thanks!
by JasonHelmick at 2013-02-06 17:35:19
Wow Eurisko, that is really good question. So, I have monitored requests…I mean AppCmd list requests will do that…but killing a request that is taking too long…thats interesting. So I’ve been working with it. Give me a day to see if I can come up with something or if someone else has an idea.

There must be a way to do it…but let me see if I can figure out a PowerShell line that will help you. I"ll post back soon!

Jason
by JasonHelmick at 2013-02-07 11:00:54
Hi Eurisko!

Recycling the app pool is the only way to kill a request. You can find long running requests using powershell:
$Req=Get-WebRequest -AppPool <yourAppPool> | Where-Object {$_.TimeElapsed -gt 10000}

Then if a request is running too long, restart the application pool. Keep in mind (and you already know this) that resetting the pool will kill the worker process and all requests for that pool.

Restart-WebAppPool -Name <AppPoolName>

Jason

Man Jason. I was hoping you had found a way to do this.