如何根据谁登录到Windows运行Windows服务 [英] how to run windows service based on who's LogIn to windows

查看:57
本文介绍了如何根据谁登录到Windows运行Windows服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我正在开发Windows服务。

在Windows服务中,我从Web服务获取数据。所以我添加了Web引用并成功获取数据。它工作正常。



但我所做的是Web Service Credentials就像下面的硬编码一样。

Hi all,

I am working on windows service.
In windows service I am get the data from Web Service. So I add web reference and get the data successfully. It''s working fine.

But what I do is Web Service Credentials are Hard Code it like below.

Test_Service tcsrvc = new Test_Service();
            Test[] tc;

            tcsrvc.Credential = new System.Net.NetworkCredential("username", "password");
            tc = tcsrvc.ReadMultiple(null, null, 0); 



在我的问题中,如果假设此用户名已从Windows停用,则此凭据无效。



那怎么能实现呢?没有硬编码凭证。







如何通过Windows登录用户名和密码到这个网站服务凭证?



提前致谢...........


In my question is if suppose this username is deactivated from windows LogIn this credentials are not working.

So how can acheive this? without hard code the credential.

or

how to pass windows LogIn username and password to this web service credentials?

Thanks in advance...........

推荐答案

本文可以帮助您: HOW TO:将当前凭据传递给ASP.NET Web服务 [ ^ ]
This article may help you: HOW TO: Pas Current Credentials to an ASP.NET web service[^]


这篇关于如何根据谁登录到Windows运行Windows服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆