我正在尝试在Visual Studio 2013中的开发环境中为localhost定义别名.
当我使用以前版本的Visual Studio时,我使用Visual Studio开发服务器进行调试,我唯一需要做的就是更改我的hosts文件添加此条目:
127.0.0.1 localhost
127.0.0.1 localhostalias
Run Code Online (Sandbox Code Playgroud)
我在使用VS2013时遇到了问题.我已经浏览了整个互联网,我尝试了以下的事情,但我希望有人告诉我我做错了什么.我显然已经改变了主机文件......
在Web项目属性 - > Web的"默认情况下选择IIS Express的服务器"部分中,我尝试更改http://localhost:53944为http://localhostalias:53944但显示错误:" Unable to create the virtual directory. Cannot create the Web site 'http://localhostalias:53944'. You must specify "localhost" for the server name".
我还尝试更改位于<>\IISExpress\config中的applicationhost.config
<site name="<<Site name>>" id="2">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="<<Site Path>>" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:53944:*" />
</bindings>
</site>
Run Code Online (Sandbox Code Playgroud)
当我打开项目时,它被改为
<site name="<<Site name>>" id="2">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="<<Site Path>>" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:53944:*" …Run Code Online (Sandbox Code Playgroud)