所以,请允许我告诉您,我正在MVC 5中开发 IIS监控网站
So Let me tell you that I am developing a IIS monitoring Website in MVC 5
我尝试在C#代码中停止应用程序但它总是抛出异常。标题中提到。
I try to stop an application within C# code but it always throw exception. mentioned in the title.
我正在使用代码:
ServerManager manager = new ServerManager(@"C:\Windows\System32\inetsrv\config\applicationHost.config"); foreach (Site site in manager.Sites) { site.Stop(); }例外是:
{"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" />没有什么不起作用。因为我无法将此清单文件添加到MVC应用程序,因为项目属性下的组合框在那里没有显示清单文件。
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.
我想在我的MVC应用程序中列出IIS服务器中的所有网站。此外,我需要从我的MVC应用程序停止/启动网站。
推荐答案因此,在很多R& D之后我能回答我自己的问题。我刚刚将应用池权限从 AppPoolIdentity 更改为 LocalSystem ,一切都很好。
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.
更多推荐
该方法或操作未实现。在C#中停止IIS网站
发布评论