The method or operation is not implemented. while stopping IIS website in C#

情到浓时终转凉″ 提交于 2019-12-13 16:09:41

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/39349157/the-method-or-operation-is-not-implemented-while-stopping-iis-website-in-c-shar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!