解决方案 »
- 如何用反射动态给Property添加Attribte
- winform 打断while循环
- c# 组件的路径 怎么查询
- winform中DataGridView在应该什么事件里进行数据验证?
- 如何用.net访问数码相机,读取照片
- 数据库列为NULL,帮定控件老是提示出错,出错内容请看,帮帮我
- ###未将对象引用设置到对象的实例。
- 急急急急!!!C#实现UDP超时重传的问题??
- 我做了个应用,有三个窗体,运行时在操作系统的toolbar中出现了三个button,如何解决?
- c# 连 sql server ...还是不好使。(我从初一连到初五,还是没连上)。救命。。
- 关于win32Exception异常的问题
- c#使用Tamir.SharpSsh 下载不了中文名文件
{
LinkButton serviceButton = (LinkButton)sender;
string name = serviceButton.ID; ManagementPath path = new ManagementPath(); path.Server = System.Environment.MachineName; path.NamespacePath = @"root\CIMV2"; path.RelativePath = "Win32_service.Name='" + name + "'"; ManagementObject service = new ManagementObject(path); ManagementBaseObject temp = service.InvokeMethod("StartService", null, null); Thread.Sleep(100); GetStoppedServices();
}ProcessInfo = new ProcessStartInfo("cmd.exe", "/C net start " + name);
ProcessInfo.CreateNoWindow = true;
ProcessInfo.UseShellExecute = false;
Process = Process.Start(ProcessInfo);
Process.Close();这两段是.net 对windows service操作的代码。但是你的网站进程所运行的账户有足够权限。修改应用程序池运行账号的修改方法参考:
1.开始-->执行-->输入inetmgr-->回车,启动iis。2.在连接面板, 展开服务器节点,点击应用程序池。3.在应用程序池页面, 点击你要设定程序执行账户的程序池, 右键弹出操作菜单,点击高级选项。4.点击标识属性的...按钮,打开应用程序池标识属性设置对话框5.如果使用系统的内建账号,选择下拉列表项对应账号就好。如果使用自定义账户,需要确认密码。设定好后,点击确认,重启程序池。