Service EventLogPermission Failed
I have developed a .NET service and it's been running well on my dev machine for ages. I've tested deploying it and have never experienced any permission issues.
When I came to deploy the service to a test location, however, I was greeted with this error:
Request for the permission of type 'System.Diagnostics.EventLogPermission, System, Version=2.0.0.0, Culture=neu开发者_Go百科tral, PublicKeyToken=b77a5c561934e089' failed.
The service has permission to write to the event log because it actually does write some events.
What could be going on here?
P.S. I am not prepared to adjust any security zones or run my service under a special account.
The problem was that the Service loaded some assembly at runtime, and in my Test deployment I had pointed to the assembly (in the application config) using UNC network share. (e.g. \machine\d$...) In my Dev deployments I was pointing to it using a local absolute reference (D:......)
The LocalSystem account has very tight permissions, including not being able to access files on a remote machine. Additionally, the .Net Framework usually doesn’t like running remote assemblies.
We know this, but it slipped my mind during the deployment.
Changing the assembly path to the local form resolved this issue.
精彩评论