是否有一个.NET库或API与/编辑I​​IS元数据库进行交互? [英] Is there a .NET Library or API to interact with/Edit the IIS Metabase?

查看:169
本文介绍了是否有一个.NET库或API与/编辑I​​IS元数据库进行交互?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

...还是我坚持我自己的滚动XML斩的职能。我想创建一个小的任务栏的应用程序,所以我可以很快重新指向一个Virual目录的几个文件夹之一在我的硬盘。

...or am I stuck rolling my own "XML chopping" functions. I'd like to create a small tasktray app so I can quickly re-point a Virual Directory to one of several of folders on my harddisk.

背景位:

我有我们的code基地的3个不同的分支的svn我的dev的机器上。

I have 3 different svn branches of our code base on my dev machine.

Current Production Branch    ( C:\Projects\....\branches\Prod\ )
Next Release Canidate Branch ( C:\Projects\....\branches\RCX\ )
Trunk                        ( C:\Projects\....\trunk\ )

我们的应用程序与我已经安装在

Our app integrates with a 3rd party CMS which I've installed at

http://localhost/cms/

在为了工​​作我们的应用程序必须住在相同的根目录。所以:

In order to work our app has to live at the same root directory. so:

http://localhost/app/

根据不同的分支我的工作,我重新指向 /应用/ 目录通过进入IIS管理器上面列出的3路径之一。只是觉得它会是方便有一个快速的应用程序来为我做的。

Depending on the branch I'm working on, I'm re-pointing the /app/ directory to one of the 3 paths listed above by going into IIS Manager. Just thought it'd be handy to have a quick-app to do it for me.

推荐答案

好吧...这不是一个托盘应用程序,但你可以在命令行中运行它。只是改变了物理路径,必要的:

Ok...this isn't a tray app but you can run it from the command line. Just change the physical paths as necessary:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.DirectoryServices;

namespace Swapper
{
  class Program
  {
    static void Main(string[] args)
    {
      using (DirectoryEntry appRoot = 
               new DirectoryEntry("IIS://Localhost/W3SVC/1/root/app"))
      {
        switch (args[0].ToLower())
        {
          case "prod":
            appRoot.Properties["Path"].Value = @"e:\app\prod";
            appRoot.CommitChanges();
            break;

          case "rcx":
            appRoot.Properties["Path"].Value = @"e:\app\rcx";
            appRoot.CommitChanges();
            break;

          case "trunk":
            appRoot.Properties["Path"].Value = @"e:\app\trunk";
            appRoot.CommitChanges();
            break;

          default:
            Console.WriteLine("Don't know");
            break;
        }
      }
    }
  }
}

然后在运行:

C:\>swapper prod
C:\>swapper rcx

这篇关于是否有一个.NET库或API与/编辑I​​IS元数据库进行交互?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆