解决方案 »

  1.   

    用runas命令提升权限。自己google下用法。
      

  2.   

    通过asp.net启动服务器端的服务肯定是可以做到的,不过绝对不能在没有权限管控的情况下去,匿名访问的页面去做这种动作。windowsservice通常运行在一个本地系统账户的权限下,这样的账号通常具有非常高权限,使用这个账户可以在你的系统中做很多事情。然而,asp.net web线程运行在ASPNET账户下(windows xp)或者NETWORKSERVICE账户下(windows 2003)。服务的启动用户也要加上这个用户角色。
      

  3.   

    protected void StartService(object sender, EventArgs e)
    {
        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.如果使用系统的内建账号,选择下拉列表项对应账号就好。如果使用自定义账户,需要确认密码。设定好后,点击确认,重启程序池。