配置IIS Express以便通過IP地址訪問調試的網站

來源:互聯網
上載者:User

標籤:style   http   color   io   os   使用   ar   java   for   

問題背景

最近使用C#編寫了一個WebService,希望通過Java進行調用。使用Visual Studio 2013調試WebService時,可以在瀏覽器中通過localhost地址訪問WSDL檔案。

訪問方式如:http://localhost:2256/DataProvider.asmx?WSDL。

但是,當使用http://127.0.0.1:2256/DataProvider.asmx?WSDL或者使用http://[本機IP]:2256/DataProvider.asmx?WSDL時,顯示Bad Request錯誤。

現在希望其他機器訪問原生WSDL檔案,所以要求WebService可以使用IP地址訪問。

開發環境:

1)Windows 7

2)Visual Studio 2013

配置方法

1)找到<我的文件>/IIS Express檔案夾,開啟applicationhost.config。

2)在設定檔中找到<sites></sites>標籤。

3)<sites>標籤內包含許多<site>標籤,找到WebService所在的<site>標籤,如 <site name="DataProvider" id="2">。

4)在<site>標籤內找到<bindings>標籤,在<bindings>找到<binding>標籤的bindingInformation屬性,如bindingInformation="*:2256:localhost"。

5)修改localhost為*。有關bindingInformation的詳細資料參考這裡。

6)使用管理員權限重新啟動Visual Studio 2013。

7)偵錯工具。

8)結束。

備忘

bindingInformation設定方法:

1)如果希望對所有IP綁定80連接埠,並且不指定host名稱,則設定為“*:80:”。

2)如果希望對所有IP綁定80連接埠,並且指定host名稱為microsoft.com,則設定為“*:80:microsoft.com”。

2)如果希望對固定IP(192.168.1.150)綁定8080連接埠,則設定為“192.168.1.150:8080:”。

配置IIS Express以便通過IP地址訪問調試的網站

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.