IIS Express 捕获所有子域 url
我正在寻找 IIS Express 中子域包罗万象 url 的解决方案。
基本上,我环顾四周并找到了如何在 IIS Express 中创建域/子域。
它很容易找到,我所要做的就是在 IIS Express 的 ApplicationHost.config 中添加另一个绑定,并更改我的主机文件以将 127.0.0.1 指向该域。
这是 IIS 快速配置文件:
<binding protocol="http" bindingInformation="*:80:domain.com" />
<binding protocol="http" bindingInformation="*:80:sub.domain.com" />
但是,我找不到任何方法来创建包罗万象的 URL。可能是我在某个地方疏忽了,我什至尝试过(也许天真地)*:80:*.domain.com
和*:80:*
。
我搜索过但无法回答的另一个问题是将 IIS Express 完全绑定到一个包罗万象的 url(例如,每个请求都应该通过特定端口的 IIS Express)。
如果重要的话,我正在使用 ASP.NET MVC 3 应用程序。
I'm looking for a solution for a subdomain catch-all url in IIS Express.
Basically, I've looked around and found how to create domains/subdomains in IIS Express.
It was quite easy to find, and all I had to do was add another binding in the ApplicationHost.config for IIS Express, and change my hosts file to point 127.0.0.1 to the domain.
This is the IIS express config file:
<binding protocol="http" bindingInformation="*:80:domain.com" />
<binding protocol="http" bindingInformation="*:80:sub.domain.com" />
However, I couldn't find any way to create a catch-all URL. There might have been an over-sight from me somewhere, I even tried (maybe naively) *:80:*.domain.com
and *:80:*
.
Another question that I've searched but couldn't an answer to is binding IIS express to a catch-all url completely (as in, every request should pass through IIS Express for a specific port).
If it matters I'm using an ASP.NET MVC 3 application.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不幸的是,我认为这是不可能的,因为 IIS 不支持通配符域。以下站点详细介绍了潜在的解决方法。
http://forums.iis.net/t/1095760.aspx
https://serverfault.com/questions/165660/wildcard-subdomains-on-localhost-using-iis7
IIS7 中的通配符子域。是否可以使它们像 Apache 中一样?
以下 文章解释了 IIS 绑定的工作原理。关于你的第二个问题,文章指出:
Unfortunately, I don't believe this is possible, because IIS does not support wildcard domains. The following sites detail potential workarounds.
http://forums.iis.net/t/1095760.aspx
https://serverfault.com/questions/165660/wildcard-subdomains-on-localhost-using-iis7
Wildcard subdomains in IIS7. Is it possible to make them like it is in Apache?
The following article explains how IIS bindings work. In relation to your second question, the article states:
我对 IIS Express 不太熟悉,但通常如果您不设置主机名字段,那么 IIS 将为默认网站上的所有域的所有请求提供服务。所以你基本上会绑定到 127.0.0.1:80 并“捕获”所有内容。
但就像我说的,我不知道 IIS Express 是否可以这样工作。
I'm not that familiar with IIS Express, but typically if you don't set a hostname field, then IIS will service all requests, for all domains on the default web site. So you would basically bind to 127.0.0.1:80 and that "catch" everything.
But like I said, i don't know if IIS Express works this way or not.