6

I'm just starting to use Visual Studio 2010 SP1 with IIS Express. When Visual Studio launches IIS Express, it specifies the name of the "site" to launch IIS Express with. The name of the site seems to be derived from the name of my web project. Is it possible to have Visual Studio launch a site with some other name? For instance, if my web project's name is "WebProject1", when Visual Studio launches IIS Express, it will use the following command:

iisexpress.exe /site:WebProject1

I would like to force it to do this instead:

iisexpress.exe /site:MyMasterSite

Any ideas out there?

FlyingDeveloper
  • 342
  • 2
  • 10

1 Answers1

8

You will want to change this in the applicationhost.config file. This can be found in the user/documents/iisexpress/config folder. In the config file, under the system.applicationhost node you will find a sites node that should allow you to set the name in the site name node.

    <sites>
        <site name="WebSite1" id="1" serverAutoStart="true">
            <application path="/">
                <virtualDirectory path="/" physicalPath="%IIS_SITES_HOME%\WebSite1" />
            </application>
            <bindings>
                <binding protocol="http" bindingInformation=":8080:localhost" />
            </bindings>
        </site>
        <siteDefaults>
            <logFile logFormat="W3C" directory="%IIS_USER_HOME%\Logs" />
            <traceFailedRequestsLogging directory="%IIS_USER_HOME%\TraceLogFiles" enabled="true" maxLogFileSizeKB="1024" />
        </siteDefaults>
        <applicationDefaults applicationPool="Clr4IntegratedAppPool" />
        <virtualDirectoryDefaults allowSubDirConfig="true" />
    </sites>
Jesse McCulloch
  • 683
  • 4
  • 13
  • 3
    I changed the name of the site in the IISE config file, and at first, visual studio wasn't happy about it (saying something about not being able to start IISE). After closing and reopening the solution, VS is able to launch IISE and the debugger attaches. I was thinking that the site name used to launch IISE was stored somewhere (like a project file), but I couldn't find it. Now it seems like VS is parsing the IISE config file and finding the site hosting the URL specified in the project's properties. Interesting. Thanks for your help! – FlyingDeveloper Apr 18 '11 at 18:47
  • @FlyingDeveloper - I'm glad it worked for you. It was probably storing data in a temp file or memory, which is why it was barking at you at first. – Jesse McCulloch Apr 18 '11 at 19:01
  • 1
    I believe the only URL in the project properties is the startup URL for debugging. Instead, it makes sense that Visual Studio would look for an IIS Site that has a matching physical path. Visual Studio makes the match when the project is loaded, so you just need to close and reopen the solution, not exit Visual Studio. – Edward Brey Mar 08 '13 at 03:31