ServiceBase Credentials
I have a window service that Inherits System.ServiceProcess.ServiceBase. While running in debug mode (havent tested compiled), the thread does not see the current user credentials.
I need the credentials so I can set up the WebProxy and I would prefer to use the account that service is running under instead of passing the user and pwd as a string.
Can someone help me figure out why the code running in the class the inherits from ServiceBas开发者_如何转开发e does not have have the credentials of the logged in user?
I have resolved my issue.
Firstly, you can access the user through the WindowsIdentity object although this was actualy not the issue after all. The Credentials were indeed blank but it was caused by some project setting.
As a solution, I created a new windows service project and added my original class files and everything worked great. I did try a file compare and did not discover the exact cause or the differences between the old and new projects. However I suspect it was either the fact that a manifest file (UAC) existed or possibly the settings in basicHttpBinding in my config file.
精彩评论