I'm trying to define an alias to localhost in development ambient in Visual Studio 2013.
When I used previous versions of Visual Studio, I used the Visual Studio Development Server to debug and the only thing I needed to do was to change my hosts file adding this entry:
127.0.0.1 localhost
127.0.0.1 localhostalias
I'm having problems to do this with VS2013. I've browsed all over the internet and I've tried the following things, but I'd like someone of you to tell me what am I doing wrong. I've obviously already changed the hosts file...
In the web project Properties -> Web in the section Servers where IIS Express is selected as default, I tried changing http://localhost:53944
to http://localhostalias:53944
but an error is showed saying: "Unable to create the virtual directory. Cannot create the Web site 'http://localhostalias:53944'. You must specify "localhost" for the server name
".
I also tried changing the applicationhost.config which is located in <>\IISExpress\config to
<site name="<<Site name>>" id="2">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="<<Site Path>>" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:53944:*" />
</bindings>
</site>
And when I opened the project it was changed to
<site name="<<Site name>>" id="2">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="<<Site Path>>" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:53944:*" />
</bindings>
</site>
<site name="<<Site name>>(1)" id="3">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="<<Site Path>>" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:53944:localhost" />
</bindings>
</site>
Can someone help me?
Thanks in advance,
Camilo
If you reach this page looking for a solution for VS2015+, the applicationhost.config
file you are looking for is no longer on documents\IISExpress\config
.
The new location is {solutiondir}\.vs\config\applicationhost.config
.