3

So Let me tell you that I am developing a IIS monitoring Website in MVC 5

I try to stop an application within C# code but it always throw exception. mentioned in the title.

I am using code:

ServerManager manager = new ServerManager(@"C:\Windows\System32\inetsrv\config\applicationHost.config");

foreach (Site site in manager.Sites)
{
    site.Stop();
}

The exception is:

{"The method or operation is not implemented."}
   at Microsoft.Web.Administration.Interop.IAppHostMethodInstance.Execute()
   at Microsoft.Web.Administration.ConfigurationMethodInstance.Execute()
   at Microsoft.Web.Administration.ConfigurationElement.ExecuteMethod(String methodName)
   at Microsoft.Web.Administration.Site.Stop()
   at WebsiteReplication.Repository.IISConfiguration.VerifyWebsites(List`1 websitesDirs) in e:\RLTSquare\MetisSilverlight\Code\WebsiteReplication\WebsiteReplication\Repository\IISConfiguration.cs:line 67

What I have read uptil now that I need to run my website under administrator privilages. I did that also, I also tried to add manifest file and than changing the access level by this line of code

<requestedExecutionLevel  level="requireAdministrator" uiAccess="false" />

Nothing is not working. As I cannot add this manifest file to MVC application because the combobox under properties of the project does not show menifest file there.

I want to list all websites from IIS server in my MVC application. Also I need to stop/start website from my MVC application.

Manoz
  • 6,507
  • 13
  • 68
  • 114
CodeGenius
  • 514
  • 1
  • 6
  • 21
  • Did you check this? http://stackoverflow.com/questions/19181418/got-an-error-while-using-workerprocess-getrequests-method-from-microsoft-web-adm – Benjamin Soulier Sep 06 '16 at 12:51
  • The problem occurs on my local machine IIS, since I am in developement stages. Can you please tell me where can I find the path Roles and Features Wizard -> Server Roles -> Web Server (IIS) -> Web Server -> Health and Diagnostics -> Request Monitor – CodeGenius Sep 06 '16 at 13:07
  • So everything is all working ?:) – Laurent Lequenne Sep 06 '16 at 13:08
  • still stuck. Where can i find: Roles and feature wizard on my local machine? – CodeGenius Sep 06 '16 at 13:10
  • Which version of `Microsoft.Web.Administration` are you using? – Anton Gogolev Sep 07 '16 at 18:54
  • I installed latest from nuget. Its 10.x. I gave absolute path of IIS in ServerManager constructor. Actually it was reading IISExpress websites before. But the problem was only solved by changing the AppPoolIdentity to Local System – CodeGenius Sep 07 '16 at 18:56

1 Answers1

2

So, after alot of R&D i am able to answer my own question. I just changed the app pool rights from AppPoolIdentity to LocalSystem and everything was fine.

CodeGenius
  • 514
  • 1
  • 6
  • 21