Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop Visual studio/IIS express from creating new <site> every time it is restarted in applicationhost.config

I am developing a web application in visual studio 2012 and every time I close and open visual studio it creates a new entry with default settings in IIS express's applicationhost.config and since I am using a browser from another machine (windows is in a vm) I have to go into applicationhost.config and fix the binding to * rather than localhost so I can browse to the website.

This is starting to get pretty annoying and I have searched online but I couldn't find any info on it. Does anybody happen to know how to stop this from happening?

like image 257
Jamesla Avatar asked Jul 06 '13 23:07

Jamesla


People also ask

How do I disable IIS Express in Visual Studio?

Closing IIS Express By default Visual Studio places the IISExpress icon in your system tray at the lower right hand side of your screen, by the clock. You can right click it and choose exit. If you don't see the icon, try clicking the small arrow to view the full list of icons in the system tray.

How do I change IIS Express settings in Visual Studio?

Configure IIS express on visual studioSelect the web application project and open properties -> select the web tab -> under server's select IIS express-> Specify the project URL. Now open the project folder and . vs folder (Hidden) -> Config -> applicationhost.

How do you stop IIS Express running?

Right click your project > click Properties > select the 'Web' tab on the left > uncheck the 'Enable Edit and Continue' checkbox.


2 Answers

Inside the bindings section of the site section, create a new binding in addition to the localhost version like so:

 <bindings>
     <binding protocol="http" bindingInformation="*:21232:localhost" />
     <binding protocol="http" bindingInformation="*:21232:*" />
 </bindings>

After having both lines, VS stopped making new site sections.

like image 143
Stuart Allen Avatar answered Sep 30 '22 18:09

Stuart Allen


Have you set the URL it should use in the project csproj file? You can lock it down there to localhost and a port number :)

For example:

<ProjectExtensions>
    <VisualStudio>
      <FlavorProperties GUID="{whatever your guid is}">
        <WebProjectProperties>
          <UseIIS>True</UseIIS>
          <AutoAssignPort>False</AutoAssignPort>
          <DevelopmentServerPort>12345</DevelopmentServerPort>
          <DevelopmentServerVPath>/</DevelopmentServerVPath>
          <IISUrl>**http://localhost:portnum**/IISUrl>
          <NTLMAuthentication>False</NTLMAuthentication>
          <UseCustomServer>False</UseCustomServer>
          <CustomServerUrl>
          </CustomServerUrl>
          <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
        </WebProjectProperties>
      </FlavorProperties>
    </VisualStudio>
  </ProjectExtensions>
like image 26
Auri Rahimzadeh Avatar answered Sep 30 '22 17:09

Auri Rahimzadeh