IIS Express 捕获所有子域 url

发布于 2024-10-31 13:55:15 字数 620 浏览 3 评论 0原文

我正在寻找 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

从此见与不见 2024-11-07 13:55:15

不幸的是,我认为这是不可能的,因为 IIS 不支持通配符域。以下站点详细介绍了潜在的解决方法。

http://forums.iis.net/t/1095760.aspx

https://serverfault.com/questions/165660/wildcard-subdomains-on-localhost-using-iis7

IIS7 中的通配符子域。是否可以使它们像 Apache 中一样?

以下 文章解释了 IIS 绑定的工作原理。关于你的第二个问题,文章指出:

最短的可能绑定是
为具有单个 IP 的服务器保留
和网站,或者如果您想拥有
没有其他绑定时的“包罗万象”站点
适合。此绑定使用 IP
通配符且没有主机头,将是
当没有其他的时候绝对最后应用
可以找到绑定匹配。在这个
在这种情况下,绑定将是:

http *:80:

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:

The shortest possible binding is
reserved for servers with a single IP
and site, or if you wish to have a
“catch-all” site when no other binding
fits. This binding, which uses the IP
wildcard and no host header, would be
applied absolutely last when no other
binding match could be found. In this
case the binding will simply be:

http *:80:

独闯女儿国 2024-11-07 13:55:15

我对 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文