该方法或操作未实现。在C#中停止IIS网站

编程入门 行业动态 更新时间:2024-10-26 05:30:47
本文介绍了该方法或操作未实现。在C#中停止IIS网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

所以,请允许我告诉您,我正在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网站

本文发布于:2023-11-14 19:09:12,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1588286.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:操作   方法   网站   IIS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!