开发者

Remote LogOn with WCF and C#

Is there any way to log on to a Windows machine using WCF and C#? I am creating a Test Harness and it will needed to remotely logon a Windows user.

So far we have not been able to do it successfully as once the user has been log off from the mac开发者_运维百科hine, self-hosted WCF is shut down.


your problem is that you are hosting the service as a console app. When the user logs off, the app stops.

Host your service in a windows service, which will enable it to start and run without a user being logged on.

MSDN on hosting in a windows service

as a tip, in the OnStart method add the following line:

Debugger.Launch(); 

and a using statement:

using System.Diagnostics;

if you have problems with the service starting and immediately stopping. This should allow you to attach a debugger to the service as it is starting to debug the issue.


Using supplied credentials on the web end you could try logging in via WMI? but, it does depend what you intend to do to the remote machines - other option would be a client on the remote machines

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜