Ошибка вызова NT сервиса из .aspx
От: shmelev Россия  
Дата: 20.08.03 11:33
Оценка:
Привет всем!
Народ помогите пож-ста, иначе уволят!
Есть C# NT-сервис, в котором реализован remote object. Надо из .aspx запустить сервис.
Делаю так:

private void Button1_Click(object sender, System.EventArgs e)
{
  if (service.Status != ServiceControllerStatus.Running)
    service.Start();
}



При запуске выдает ошибку:

=======================================================

Server Error in '/InteropTest/WebTestServiceTest' Application.
--------------------------------------------------------------------------------

Отказано в доступе
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ComponentModel.Win32Exception: Отказано в доступе

Stack Trace:


[Win32Exception (0x80004005): Отказано в доступе]

[InvalidOperationException: Cannot open TestServiceTest2 service on computer '.'.]
System.ServiceProcess.ServiceController.GetServiceHandle(Int32 desiredAccess) +175
System.ServiceProcess.ServiceController.Start(String[] args) +114
System.ServiceProcess.ServiceController.Start() +24
WebTestServiceTest.WebForm1.Button1_Click(Object sender, EventArgs e) in d:\inetpub\wwwroot\interoptest\webtestservicetest\webform1.aspx.cs:72
System.Web.UI.WebControls.Button.OnClick(EventArgs e)
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()

=======================================================

Из консоли все работает.
Как лечить?
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.