开发者

Is there any reason why a Win Service would not execute functions in an external library?

I am new to writing Windows Services so this is really strange to me. I have debugged an external library using a WinForm. The external library does some drive mapping, copying a directory structure, deleting the original directory, renaming the copied directory, and then removes mappings.

So, when I write up the service to initialize the external class and start the process, the service doesn't seem to be doing what I think it should be doing. It appears to be doing nothing and completely ignoring what is going on.

Is there anything I am missing? Does the external library need to have any Security attributes?

Update Found out how to attach a debugger, per @W开发者_StackOverflow社区ill's comment: System.Diagnostics.Debugger.Break()

Edit

It also helps when you copy your app.config file to the correct directory!!!


Not a lot to go on here. First, you can debug your service, which is what you should be doing rather than using a winform frontend to test your code.

The issue is either that your service is not created properly, or that you've got a security issue.

Your service will receive a start message, after which it must run its own code, often on a different thread (a Timer is a common way to do this).

If the service is touching a drive, the user account under which it executes must have rights to perform the operations it attempts. Try changing the user account under which it executes to your own and see if it starts working.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜