简体   繁体   English

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

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

So Let me tell you that I am developing a IIS monitoring Website in MVC 5 因此,让我告诉您,我正在MVC 5中开发IIS监视网站

I try to stop an application within C# code but it always throw exception. 我尝试在C#代码中停止应用程序,但始终会引发异常。 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. 由于无法将清单文件添加到MVC应用程序中,因为项目属性下的组合框未在其中显示清单文件。

I want to list all websites from IIS server in my MVC application. 我想在我的MVC应用程序中列出IIS服务器中的所有网站。 Also I need to stop/start website from my MVC application. 另外,我需要从MVC应用程序停止/启动网站。

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. 我只是将应用程序池的权限从AppPoolIdentity更改为LocalSystem ,一切都很好。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 NotImplementedException:方法或操作未实现。 在 C# 中调用 GC.TryStartNoGCRegion() 时 - NotImplementedException: The method or operation is not implemented. when calling GC.TryStartNoGCRegion() in C# 错误:未实现方法或操作。 而脚手架MYSQL数据库 - Error: The method or operation is not implemented. while scaffolding MYSQL Database 在C#中停止IIS - Stopping IIS in C# 实体框架核心,UD sql function 抛出 System.NotImplementedException:“方法或操作未实现。” - Entity Framework Core, UD sql function throws System.NotImplementedException: 'The method or operation is not implemented.' 未实施该方法或操作。 Microsoft.EntityFrameworkCore.DbSet`1.System.Linq.IQueryable.get_Provider() - The method or operation is not implemented. Microsoft.EntityFrameworkCore.DbSet`1.System.Linq.IQueryable.get_Provider() 在安装新插件期间nopCommerce插件中的错误“方法或操作未实现。” - What is the error “The method or operation is not implemented.” in nopCommerce plugin during installing a new plugin 具有“未实现方法或操作”异常的C#Dapper QueryFirstOrDefault方法 - C# Dapper QueryFirstOrDefault method with “The method or operation is not implemented” exception C#PowerShell远程处理问题:未实现方法或操作 - C# PowerShell Remoting issue: method or operation not implemented 在C#中停止和启动IIS - Stopping and Starting IIS in C# 使用linq进行休眠时未实现该方法或操作 - The method or operation is not implemented while using linq to nhibernate
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM