如何设置hostHeader正确的子域? [英] How to set hostHeader correctly for subdomains?

查看:660
本文介绍了如何设置hostHeader正确的子域?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了两个网站是这样的:

I have created a two sites like this:

<Sites>
  <Site name="WebRole" physicalDirectory="./WebRole">
    <Bindings>
         <Binding name="Endpoint1" endpointName="HttpEndpoint" />
    </Bindings>
  </Site>   
  <Site name="MySite" physicalDirectory="./MySite">         
      <Bindings>                     
         <Binding name="Endpoint" endpointName="HttpEndpoint"  hostHeader="www.MySite.com"/>                    
      </Bindings>     
  </Site>
</Sites>

我已经下CNAME(别名)改变了我的DNS - > www会xxx.cloudapp.net

I have changed my DNS under CNAME (Alias) -> www to xxx.cloudapp.net

因此​​,当我输入www.MySite.com它得到我的云应用程序,该hostHeader是公认的,去到正确的物理站点。该HostHeader工作正常。

Therefore when I type in www.MySite.com it gets to my cloud app, the hostHeader is recognized and goes to the right physical site. The HostHeader works fine.

现在我尝试做同样的事情,作为一个子域。

Now I try to do the same thing as a subdomain.

<Site name="MySite" physicalDirectory="./MySite">       
        <Bindings>                   
            <Binding name="Endpoint" endpointName="HttpEndpoint"  hostHeader="sub.MySite.com"/>                     
        </Bindings>       
</Site>

在DNS经理,我没有尝试这样做的CNAME,而是我做了子域到同方的地址xxx.cloudapp.net的蒙面转发。

In DNS manager I didn't try to do it in CNAME but instead I did a masked Forward of the sub domain to the same side's address xxx.cloudapp.net.

但是,这并不正常工作。它只是打开了第一个网站来代替。似乎HostHeader不以指向所述第二物理路径理解

But this doesn't work. It simply open up the first Site instead. It seems the HostHeader is not understood in order to point to the second physical path.

我是什么失踪?

推荐答案

据我可以告诉蒙面转发的使用帧通常工作,并且如果是这样的主机的头信息不会被转发到Azure中的情况。

As far as I can tell "masked forwarding" usually works by using frames, and if that's the case the host header information won't be forwarded to Azure.

您的DNS主机将创建一个网站有一个框架,并且该帧的数据将来自xxx.cloudapp.net网站。至于有没有转发主机的头信息Azure的负载均衡器将无法使用备用站点。

Your DNS host will create a Web site with a frame, and the data for that frame will come from the xxx.cloudapp.net site. As there's no host header information forwarded the Azure load balancer won't be able to use the alternate site.

我害怕它看起来你需要使用CNAME系统明确地转发的主机名。

I'm afraid it looks like you'll need to use the CNAME system to explicitly forward the host names.

这篇关于如何设置hostHeader正确的子域?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆