Click to See Complete Forum and Search --> : strange issue, can not control servicecontroller on my pc


rackeychen
May 28th, 2008, 04:46 AM
Hi all
Today I met one strange issue. When I used vs2005 to build a website, I can use this to control the remote server's windows service. My code looks like this:
public bool IsPublisherServiceRunning(string strPublisherServiceName)
{
bool bResult = false;
ServiceController controller = new ServiceController(strPublisherServiceName, this.m_publisherHost);
if (controller.Status == ServiceControllerStatus.Running)
{
bResult = true;
}
return bResult;
}
in the debug mode, it works well.
but, after I published the website to some directory on the same server with the source using build->publish website. it reports the error message:
"Cannot open Service Control Manager on computer '10.85.6.166'. This operation might require other privileges."
it is so strange. does someone meet the same issue before? could you please give me some tips on this.

many thanks