33

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?

ForNeVeR
  • 6,726
  • 5
  • 24
  • 43
troublemaker
  • 331
  • 1
  • 3
  • 3
  • 2
    devblog.foliotek.com link has changed. Use http://www.foliotek.com/devblog/rename-applications-and-virtual-directories-in-iis7/ instead. – Simon Elms Mar 03 '16 at 21:02

5 Answers5

33

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

Alex Nolasco
  • 18,750
  • 9
  • 86
  • 81
  • 1
    And, updating the config file did not work for me. Running appcmd did the trick. +1 – Perry Oct 01 '14 at 18:43
  • If you provide a path that parameter that isn't visible, the application might no longer be easily accessible to fix it. When I tried this, the app's Authentication settings did not follow the app to its new name. Use with caution. – Brian Aug 23 '16 at 13:59
  • 1
    Good stuff. Worked for us. – justiceorjustus Oct 09 '19 at 13:30
13

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 :)

Matt
  • 45,022
  • 8
  • 78
  • 119
Stephen Garside
  • 1,185
  • 10
  • 15
  • And for reference. Here is how you view the installed apps: `%systemroot%\syswow64\inetsrv\appcmd list app` Note: replace syswow64 with system32 if needed. – yazanpro Nov 01 '18 at 15:41
4

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

Falco Alexander
  • 3,092
  • 2
  • 20
  • 39
  • 4
    Importing the module to your Powershell session might also be needed: Import-Module WebAdministration – nodots Jun 30 '20 at 07:49
3

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

Community
  • 1
  • 1
Kev
  • 118,037
  • 53
  • 300
  • 385
-1

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.