Windows Service and Web Service - Requested registry access is not allowed

B

Brian Campbell

Gretings...

I have written a Windows Service that accesses a Web Service.

Both run fine on my development machine....

After installing both the Windows Service and Web Service on my
staging server, I get the following error...



Error Message: System.Web.Services.Protocols.SoapException: Server was
unable to process request. --->
System.Security.SecurityException: Requested registry
access is not allowed.


Can anyone point me in the right direction.....I figure it has
something to do with the security level
of the account that the Windows Service runs under...but both machines
are identical...so I dont understand why there would
be a security issue....


Thanks

Brian Campbell
 
N

Nicole Calinoiu

Do you know what is causing this error (i.e.: which registry key is being
access with what rights requested)? If your application does not use the
registry directly, does it write to the event log? If so, the problem
probably lies in creation of the hive for your application. A nice
workaround for this is to log an event during installation and/or first
configuration of the application while running in the context of an
administrator.

As for why the difference between your dev and prod machines, you're
probably an admin on your machine, and the code was probably first run under
your user context while in debug mode. If the problem is creation of a
registry key (e.g.: for an event log hive), it got created under your admin
account before you ever tried running it compiled under a different account.

HTH,
Nicole
 
N

Nicholas Paldino [.NET/C# MVP]

Brian,

By default, web services run under the ASPNET account, which is a local
account with limited access (none to the registry, I think). To get around
this, you will have to have the web service run under an account that has
permissions to access the local registry.

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top