在 IIS 7.0 中重命名应用程序

发布于 2024-11-01 22:31:12 字数 940 浏览 5 评论 0 原文

众所周知,通过IIS管理器的窗口界面编辑应用程序设置时不允许编辑应用程序别名。应用程序的别名为灰色(不允许更改)。但在本文中,您可能会发现如何通过命令行实用软件来执行此操作:

http://www.foliotek.com/devblog/rename-applications-and-virtual-directories-in-iis7/

但是还有另一种方法可以做到这一点。您可以按照本文所述编辑设置文件:

http://learn.iis.net/page.aspx/150/understanding-sites-applications-and-virtual-directories-on-iis-7/#Configuration

在设置文件中我只是更改了应用程序元素中路径属性的值(“/Site1”),仅此而已:

<application path="/Site1" applicationPool="DefaultAppPool">
    <virtualDirectory
        path="/" 
        physicalPath="C:\Sites\Site1" />
</application>

问题是我不知道这两种方式是否相同并且具有相同的结果。也许命令行实用程序(appcmd)除了重命名应用程序名称之外还做了一些额外的工作?

It's generally known that you are not allowed to edit the application alias while editing application settings through window interface of IIS Manager. The alias of an application has the gray color (not admitted to change). But in this article you may found how to do this through the command-line utility software:

http://www.foliotek.com/devblog/rename-applications-and-virtual-directories-in-iis7/

But there is an another way to do it. You can edit the settings file as it is written in this article:

http://learn.iis.net/page.aspx/150/understanding-sites-applications-and-virtual-directories-on-iis-7/#Configuration

In the settings file I just changed the value ("/Site1") of the path attribute at the application element and nothing more:

<application path="/Site1" applicationPool="DefaultAppPool">
    <virtualDirectory
        path="/" 
        physicalPath="C:\Sites\Site1" />
</application>

The issue is that I don't know whether these two ways is the same and have the same results. Maybe the command-line utility (appcmd) does some additional work except just renaming the application name?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

酷遇一生 2024-11-08 22:31:12

我最近不得不这样做,我认为你最好使用 appcmd,因为正如你所说,我们不知道幕后可能发生什么其他变化,

例如,

appcmd list app

APP "Default Web Site/" (applicationPool:DefaultAppPool)
APP "Default Web Site/develop" (applicationPool:mypool)
APP "Default Web Site/develop/xyz" (applicationPool:mypool)

就我而言,我确实必须从孩子开始重命名。否则,appcmd 将找不到子站点。

appcmd set app "Default Web Site/develop/xyz" -path:/B455/xyz
appcmd set app "Default Web Site/develop" -path:/B455

注意

appcmd list app

APP "Default Web Site/" (applicationPool:DefaultAppPool)
APP "Default Web Site/B455" (applicationPool:mypool)
APP "Default Web Site/B455/xyz" (applicationPool:mypool)

:appcmd可以在%windir%\system32\inetsrv下找到

I recently had to do this and I think you are better off using appcmd because ,as you said, we don't know what other changes may occur behind the scenes

Example,

appcmd list app

APP "Default Web Site/" (applicationPool:DefaultAppPool)
APP "Default Web Site/develop" (applicationPool:mypool)
APP "Default Web Site/develop/xyz" (applicationPool:mypool)

In my case, I did have to rename starting from the child. Otherwise, appcmd won't find the child site.

appcmd set app "Default Web Site/develop/xyz" -path:/B455/xyz
appcmd set app "Default Web Site/develop" -path:/B455

After

appcmd list app

APP "Default Web Site/" (applicationPool:DefaultAppPool)
APP "Default Web Site/B455" (applicationPool:mypool)
APP "Default Web Site/B455/xyz" (applicationPool:mypool)

Note: appcmd can be found under %windir%\system32\inetsrv

腻橙味 2024-11-08 22:31:12

我最近使用 appcmd 更改网站应用程序名称,没有出现任何问题。我以管理员身份运行了 cmd 提示符,然后:-

cd c:\windows\syswow64\inetsrv\
appcmd set app WebsiteName/applicationname -path:"/newapplicationname"

很不错:)

I have used appcmd recently to change a website application name with no issues. I ran a cmd prompt as admin then:-

cd c:\windows\syswow64\inetsrv\
appcmd set app WebsiteName/applicationname -path:"/newapplicationname"

Works a treat :)

皇甫轩 2024-11-08 22:31:12

使用 Powershell 非常简单:

rename-item IIS:\Sites\yoursitename\yourappname\ newappname

如果缺少 IIS:\ 命名空间,请确保服务器上安装了 IIS 管理脚本和工具。您可以从服务器管理器 -> 安装它Web 服务器角色 ->角色服务 ->管理工具-> IIS管理

it's very easy with Powershell:

rename-item IIS:\Sites\yoursitename\yourappname\ newappname

if the IIS:\ namespace is missing, be sure you have IIS Management Scripts and Tools installed on server(s). You can install it from Server Manager -> Web Server Role -> Role Services -> Management Tools -> IIS Management

茶底世界 2024-11-08 22:31:12

无论您使用哪种方法,这里发生的所有事情都是应用程序路径的名称发生了更改。

它真的没有什么魔力。显然,Web 应用程序中依赖于旧路径名的任何路径都需要重命名。

您可能会发现我对这个问题的回答对于了解 IIS7 中虚拟目录和应用程序的机制很有用:

使用 ServerManager 在应用程序内创建应用程序

All that is happening here, regardless of which method you use, is that the name of the application path is changed.

There's really no magic to it. Obviously any paths in your web application that depended on the old path name would need to be renamed.

You might find my answer to this question useful for gaining an understanding of the mechanics of virtual directories and applications in IIS7:

Using ServerManager to create Application within Application

小瓶盖 2024-11-08 22:31:12

我确实遇到了 appcmd 方法的问题。我的应用程序使用经典 ASP“Enable Parent Paths=True”,并使用该命令重命名将其重置为默认值 False。

I did run into a problem with the appcmd method. My application uses Classic ASP "Enable Parent Paths=True", and renaming using that command reset it to the default value of False.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文