unauthorizedaccessexception

S

sean

hi, I have a problem making window service.
My service tries to access local files and network files. when I let it
strated, unauthorizedaccessexception is occurred!
I guess my window service do not have domain authorization.
how can I endow my service with domain authorization ?
help me plz..
 
M

Marc Gravell

how can I endow my service with domain authorization ?

What account is it running as? Local Service? Network Service?

Local Service will be "anon" when calling out. Network Service will
identify using the machine's identity. If you want a specific account,
then just change the service details to use a named network account (and
restart it). You can automate this if you create an installer (msi) for
the service, but if it is only going to be installed a few times it is
just as easy to go into the services applet and change the settings there.

Marc
 
S

sean

Thanks Marc.
I modified property of service process installer as your reply.
So, my service got domain authorization.


//processInstaller.Account = ServiceAccount.NetworkService;
processInstaller.Account = ServiceAccount.User;
processInstaller.Username = "sean";
processInstaller.Password = "fdsfdsfdsf";
 
M

Marc Gravell

Just remember that it is trivial to disassemble .NET code and look at
the original source... be careful you don't compromise your password by
including it in code.

Marc
 

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