In .net, in a webservice (or website) is there an easy way of getting the name of the application pool that the service is running in, from a HttpRequest
or the HttpContext
?
Asked
Active
Viewed 1,887 times
3

Mansoor Gee
- 1,071
- 8
- 20

pheobas
- 194
- 3
- 15
-
possible duplicate of [how to get the application pool name for a specific website IIS6 programaticaly? C#](http://stackoverflow.com/questions/511263/how-to-get-the-application-pool-name-for-a-specific-website-iis6-programaticaly) – Ta01 Nov 07 '11 at 15:08
-
See [Playing around with IIS Application Pool using C#](http://weblogs.asp.net/robinkedia/archive/2009/04/28/playing-around-with-iis-application-pool-using-c.aspx), On SO - [Application Pool from C#](http://stackoverflow.com/questions/249927/application-pool-from-c-sharp) – sll Nov 07 '11 at 15:08
-
not really - since the above would only apply to IIS and neither a webservice not a website would necessarily run in IIS... – Yahia Nov 07 '11 at 15:08
-
This question was specific to IIS, so I can investigate Directory Services. It would be nice if I was able to just pluck it off the `HttpRequest`, but I suppose one can't expect everything to be simple. – pheobas Nov 07 '11 at 15:25
-
You also don't want to rely on the permissions needed from a running site (what your site runs as) to demand admin permissions via DirectoryServices over IIS. Your site should not run as admin. Don't go there... – bryanmac Nov 08 '11 at 01:25
1 Answers
0
I think its:
HttpRequest.ServerVariables["APP_POOL_ID"]
See ServerVariables on MSDN: http://msdn.microsoft.com/en-us/library/ms524602(v=vs.90).aspx

Paul Tyng
- 7,924
- 1
- 33
- 57