How to easily get the service account information?

  • Thread starter Thread starter John Lee
  • Start date Start date
J

John Lee

Hi,

I created several ApplicationPools with different windows accounts and then
assigned different application pool to different web services.
My question is from the web service, how can I easily get the service
account that host this web service?

Thanks!
John
 
Hi John,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to get the current username
for the account, under which web service is run. If there is any
misunderstanding, please feel free to let me know.

In the web service, we can use the following code to determine what user
the thread is executing as the following:

System.Security.Principal.WindowsIdentity.GetCurrent().Name

This returns the username. For more information, please check the following
link:

http://support.microsoft.com/?id=306158

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Thanks very much!!! Kevin - that's exactly what I needed!!! Happy
Holidays!!!

Can I have one more question related to the service account - When I create
an application pool with any account besides NETWORK SERVICE I got "Service
Unavailable" error. My environment is self-contained AD on one box.

I re-installed the IIS, making sure the service account I am using has
access to "Windows\Help\iishelp\common" and "Windows\system32\inetsrv\ASP
Compiled Templates"

When I tried to start the Application Pool, I got the following warning:
(Even I used an account as Domain Admin)
================================================================================
Event Type: Warning
Event Source: W3SVC
Event Category: None
Event ID: 1021
Date: 12/23/2004
Time: 10:48:32 PM
User: N/A
Computer: DEEDEE
Description:
The identity of application pool, 'OperationWSPool' is invalid. If it
remains invalid when the first request for the application pool is
processed, the application pool will be disabled. The data field contains
the error number.

For more information, see Help and Support Center at
http://go.microsoft.com/fwlink/events.asp.
Data:
0000: 2e 05 07 80
================================================================================

Best Regards,
John
 
Hi John,

It sounds like you may still be having permissions issues. The best thing
to do would be to restart IIS and then run filemon while making the first
request for your page. You can then check filemon for any Acess Denieds
related to the w3wp.exe process.

You can get this tool from http://www.sysinternals.com

You can also try to ask in the
microsoft.public.dotnet.framework.aspnet.webservices newsgroup. There are
more professionals handling this kind of errors.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Back
Top