简体   繁体   English

如何以编程方式禁用IIS6应用程序(不是虚拟目录)

[英]How do I programmatically disable IIS6 Applications (not virtual directories)

I am looking for a way to pragmatically remove IIS6 applications (via vb or c#). 我正在寻找一种实用地删除IIS6应用程序的方法(通过vb或c#)。 Through IIS Manager, this would be as simple as navigating to the application I want to disable, right click for properties and clicking remove. 通过IIS管理器,这就像导航到要禁用的应用程序一样简单,右键单击属性并单击“删除”。 This would leave the file system intact and remove the folder from being an application. 这将使文件系统保持完整,并将该文件夹从应用程序中删除。 I've seen lots of information on how to remove an entire virtual directory and delete folders, but nothing that I can find explains how to simply disable the application. 我已经看到了许多有关如何删除整个虚拟目录和删除文件夹的信息,但是找不到任何内容可以解释如何简单地禁用该应用程序。

Just to add one other complication, these applications are often nested several folders deep rather than within the root website itself. 只是为了增加其他复杂性,这些应用程序通常嵌套在多个文件夹的深处,而不是嵌套在根网站本身中。 However, I do know their exact physical path. 但是,我确实知道它们的确切物理路径。

I've spend most of my day trying to figure this one out. 我一整天都在努力解决这一问题。

The best I've been able to do with this problem is to stop and start an entire web site. 对于这个问题,我能做的最好的就是停止并启动整个网站。 If you can move your application into its own web site within IIS, this will do just what you want. 如果您可以将应用程序移到IIS中自己的网站中,则将按照您的意愿进行操作。 Read more here: http://adamprescott.net/2011/09/26/programmatically-start-stop-iis-web-sites-in-c/ 在此处阅读更多信息: http : //adamprescott.net/2011/09/26/programmatically-start-stop-iis-web-sites-in-c/

It also might be worth considering simply renaming the root directory to something like "Foo.disabled." 还可能需要考虑将根目录重命名为类似“ Foo.disabled”的内容。 I know that's not quite what you're looking for, but it'd give you a simple, straightforward solution. 我知道这不是您想要的,但是它会为您提供一个简单,直接的解决方案。 Since you know the exact physical path, it should be easy to determine the current state and provide toggle capability based on the folder name. 由于您知道确切的物理路径,因此应该容易确定当前状态并根据文件夹名称提供切换功能。 I've never gone this route; 我从没走过这条路。 I'm just thinking out loud. 我只是想大声一点。

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

相关问题 如何在IIS实例中的所有应用程序/虚拟目录/版本之间共享Oracle连接池? - How can I get an Oracle connection pool shared across all applications/virtual directories/versions in my IIS instance? 如何列出和创建所有 IIS 网站、网站中的文件夹和 C# 中的虚拟 web 目录 - How do I list and create all IIS websites, folders in the websites and virtual web directories in C# 在IIS 6.0中的子目录中创建虚拟目录(以编程方式) - Creating virtual directories in sub directories in IIS 6.0 (programmatically) IIS 6.0以编程方式 - 创建虚拟目录时出现问题而不将其设置为应用程序 - IIS 6.0 programmatically - Problem creating virtual directories AND not setting it as a Application 如何在IIS6上运行的.NET 4.0应用中读取响应标头? - How do I read response headers in a .NET 4.0 app running on IIS6? 在IIS 7中更改虚拟目录 - Changing virtual directories in IIS 7 以编程方式在 IIS6 中启用 ASP.NET - Enable ASP.NET in IIS6 Programmatically 如何以编程方式禁用系统设备? - How do I disable a system device programmatically? 如何以编程方式获取特定网站IIS6的应用程序池名称? C# - how to get the application pool name for a specific website IIS6 programmatically? C# 在IIS 7.5中创建虚拟目录 - Create Virtual Directories in IIS 7.5
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM