先生使用ASP.NET编程通过我的系统获取特定机器的所有系统服务状态
问题说明
使用以下代码的SIR我得到我的系统所有服务状态但我想看到其他机器服务状态所以请给我解决方案。
thanx
我尝试过:
使用System.Collections.Generic;
使用System.Linq;
使用System.Web;
使用System.Web.UI;
使用System.Web .UI.WebControls;
使用System.ServiceProcess;
命名空间Myservice
{
public partial class _Default:System.Web.UI.Page
{
protected void Page_Load(object sender,EventArgs e)
{
ServiceController [] services = ServiceController.GetServices(SMART);
Response.Write(运行服务列表:< br>);
foreach(服务中的ServiceController服务)
{
Response.Write( string.Format(服务名称:{0},状态{1}
,service.ServiceName,service.Status.ToString()));
}
}
}
}
SIR using following code i get my system all services status but i want to see other machine services status so please give me solution.
thanx
What I have tried:
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ServiceProcess;
namespace Myservice
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
ServiceController[] services = ServiceController.GetServices("SMART");
Response.Write("List of running services :
");
foreach (ServiceController service in services)
{
Response.Write(string.Format(" Service Name: {0} , status {1}
", service.ServiceName, service.Status.ToString()));
}
}
}
}
正确答案
您可以使用代码执行此操作你有。您需要牢记安全性,运行asp.net代码的帐户需要对目标计算机的适当访问权限,如果它是内置的匿名帐户,则无法访问其他计算机,因此您需要我需要更改代码运行的帐户(谷歌有关如何配置该代码的示例)。
请注意,您也无法访问在机器上运行的服务客户端浏览器,如果这是你最终想要做的事情。
You do it using the code you have. You need to bear in mind the security though, the account the asp.net code is running under needs appropriate access to the target machine and if it is the built-in anonymous account it won't be able to access other machines so you'll need to change the account the code runs under (谷歌 for examples on how you can configure that).
Note also you can't access services running on the machine of the client browser if that is what you're ultimately trying to do.
这篇好文章是转载于:学新通技术网
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通技术网
- 本文地址: /reply/detail/tanhcfckge
-
YouTube API 不能在 iOS (iPhone/iPad) 工作,但在桌面浏览器工作正常?
it1352 07-30 -
iPhone,一张图像叠加到另一张图像上以创建要保存的新图像?(水印)
it1352 07-17 -
保持在后台运行的 iPhone 应用程序完全可操作
it1352 07-25 -
使用 iPhone 进行移动设备管理
it1352 07-23 -
在android同时打开手电筒和前置摄像头
it1352 09-28 -
检查邮件是否发送成功
it1352 07-25 -
扫描 NFC 标签时是否可以启动应用程序?
it1352 08-02 -
Android微调工具-删除当前选择
it1352 06-20 -
Android App 和三星 Galaxy S4 不兼容
it1352 07-20 -
希伯来语的空格句子标记化错误
it1352 06-22