windows应用程序和Web应用程序的问题?
我写了一个代码,在Window应用程序里可以用,但到了web应用程序里就不能用了,不知道是什么原因
这个代码是控制Sql Server Agent服务的状态的,打开该服务的
string state = manage.GetServiceValue("MSSQL$NETSDK","state").ToString();
if(state!="Running")
{
string str = manage.StartService("MSSQL$NETSDK");
if(str==null)
this.SqlAgentState.Text = "已启动";
}
else
{
Response.Write("已经启动");
}
其中的调用是自己封装的一个类
sql server agent 服务未执行,但是在Window应用程序里就可以打开呀
我看了一篇文章,和我说的问题一样,你可以看一下
http://dev.csdn.net/develop/article/26/26153.shtm
如果在window应用程序环境下,public Win32ServiceManager():this(".",null,null)是可以的,目前我在ASP.NET下就出现“访问遭到拒绝”的异常,如果用帐号和密码构造的话,就出现“无法为本地连结使用用户凭证 ”,请问高手怎么解决?谢谢!