众所周知,通过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?
发布评论
评论(5)
我最近不得不这样做,我认为你最好使用 appcmd,因为正如你所说,我们不知道幕后可能发生什么其他变化,
例如,
就我而言,我确实必须从孩子开始重命名。否则,appcmd 将找不到子站点。
注意
: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,
In my case, I did have to rename starting from the child. Otherwise, appcmd won't find the child site.
After
Note: appcmd can be found under %windir%\system32\inetsrv
我最近使用
appcmd
更改网站应用程序名称,没有出现任何问题。我以管理员身份运行了 cmd 提示符,然后:-很不错:)
I have used
appcmd
recently to change a website application name with no issues. I ran a cmd prompt as admin then:-Works a treat :)
使用 Powershell 非常简单:
如果缺少 IIS:\ 命名空间,请确保服务器上安装了 IIS 管理脚本和工具。您可以从服务器管理器 -> 安装它Web 服务器角色 ->角色服务 ->管理工具-> IIS管理
it's very easy with Powershell:
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
无论您使用哪种方法,这里发生的所有事情都是应用程序路径的名称发生了更改。
它真的没有什么魔力。显然,Web 应用程序中依赖于旧路径名的任何路径都需要重命名。
您可能会发现我对这个问题的回答对于了解 IIS7 中虚拟目录和应用程序的机制很有用:
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:
我确实遇到了 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.