在 IIS Express 中使用自定義域 - Using Custom Domains With IIS Express

問題:

Traditionally I use custom domains with my localhost development server.傳統上,我在本地主機開發服務器上使用自定義域。 Something along the lines of:類似的東西:

dev.example.com
dev.api.example.com

This has provided me a ton of flexibility when working with external API's such as Facebook.在使用 Facebook 等外部 API 時,這爲我提供了極大的靈活性。 This has worked great in the past with the built in Visual Studio Development Server, because all I needed to do was add a CNAME to those DNS records pointing to 127.0.0.1 .這在過去使用內置的 Visual Studio 開發服務器非常有效,因爲我需要做的就是向那些指向127.0.0.1 DNS 記錄添加一個 CNAME。

However I have not been able to get this to work with IIS Express.但是,我無法讓它與 IIS Express 一起使用。 Everything I have tried seems to have failed.我嘗試過的一切似乎都失敗了。 I have even added the correct XML config to the applicationHost.config file for IIS Express, but it doesn't seem to recognize the entries as valid as a true install of IIS would.我什至已將正確的 XML 配置添加到 IIS Express 的applicationHost.config文件中,但它似乎無法將這些條目識別爲與 IIS 的真實安裝一樣有效。

<binding protocol="http" bindingInformation="*:1288:dev.example.com" />

Whenever I enter this line and try to request http://dev.example.com:1288 I get the following message:每當我輸入此行並嘗試請求http://dev.example.com:1288我都會收到以下消息:

Bad Request - Invalid Hostname錯誤請求 - 無效的主機名

Does anybody know if I am missing something obvious?有誰知道我是否遺漏了一些明顯的東西? Or did the IIS Express team really lack the foresight to see this type of use?還是 IIS Express 團隊真的缺乏預見這種用途的先見之明?


解決方案:

參考一: https://stackoom.com/question/Jl1q
參考二: Using Custom Domains With IIS Express
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章