3

I am trying to stop a website in IIS.

Here is my code

Site oSite = SERVERMANAGER.Sites.FirstOrDefault(s => s.Name.IndexOf(websiteName) > -1);
if (oSite != null)
{
    //stop the site...
    oSite.Stop();
}

When it reachers oSite.Stop(); it will throw

"The method or operation is not implemented."

I am using Windows 7 Home Premium and the version of IIS I'm using is 7.5.

Any idea how to solve this error?

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
Ng Chee Fi
  • 55
  • 1
  • 5
  • Your code works fine on my 2012 R2 when the application pool runs as `local system`. I don't have any Windows 7 anymore. Also review your lambda expression, it may not find your site (case sensitive) or may find another one (there may be another site with a similar name). Why not check for equality? – Peter Hahndorf Jun 29 '15 at 10:50
  • i'm using indexof is because i identify the unique name using some parts of the full name. I'm running on my local. i tried to run application pool as local system but still it doesn't work. Probably is cause of IIS version. Will try on my server tomorrow. Thanks man. – Ng Chee Fi Jun 29 '15 at 15:42

1 Answers1

-2

Your method may be seems like this

public void Stop()
{

throw new NotImplementedException();

}

remove above line from your method and write method code

  • So you are saying Microsoft.Web.Administration.Site, method Stop provided by Microsoft is just throwing exception? then there is no other way to fixing it? – Ng Chee Fi Jun 29 '15 at 08:32