2014-02-21 115 views
8

我試圖定義一個別名的發展環境爲localhost在Visual Studio 2013年在IIS快遞設置本地主機別名爲Visual Studio

當我使用的Visual Studio的早期版本,我使用的Visual Studio開發服務器調試和唯一我需要做的就是改變我的主機文件添加此項:

127.0.0.1 localhost  
127.0.0.1 localhostalias 

我有問題要做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來

 <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>>" 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> 

項目誰能幫了對ApplicationHost.config我?

由於提前,

卡米洛

回答

8

自從傑克的回答所鏈接的URL是目前沒有工作,和(至少對我來說)的溶液覆蓋在answer to another question,我將在這裏重複了答案:

你可以有多個綁定設置。因此,您可以設置綁定的每個外部地址,你希望擔任,這將工作:

<bindings> 
    <binding protocol="http" bindingInformation=":1904:" /> 
    <binding protocol="http" bindingInformation=":1904:machineName" /> 
    <binding protocol="http" bindingInformation=":1904:10.1.10.123" /> 
</bindings> 
0

我在這裏遇到了類似的錯誤,而且事實證明,該解決方案可以在這裏找到:http://stonycreektechnologies.com/2011/03/15/iis-express-enable-remote-requests/

對於我來說,這只是一個案例在那裏運行命令(我使用它的端口8080和端口爲我的項目,55968,只是肯定),關閉並重新打開我的項目,編輯我的applicaitonhost.config文件,然後通過更改站點的設置視覺工作室gui。

另一件需要注意的是,您可能會在applicationhost.config文件中爲您的端口號獲取多個條目。這是不好的,你只需要一個,所以你可以安全地用相同的端口剔除其他條目。

7

如果達不到這個頁面尋找一個VS2015 +的解決方案,該aplicationhost.config文件,你正在尋找已不在documents\IISExpress\config

新位置是{solutiondir}\.vs\config\applicationhost.config

相關問題