【问题标题】:How to deploy multiple web roles in Azure如何在 Azure 中部署多个 Web 角色
【发布时间】:2013-07-10 05:25:15
【问题描述】:

我阅读了多篇文章和 SO 问题,例如 - thisthisthis(以及许多其他问题)

但是它们都没有解决我的问题。我想在一个云服务中部署两个 Web 角色。我尝试部署相同的,但发现一个正在运行,而其他 Web 角色抛出 - Internet Explorer 无法在 Firefox 中显示网页/连接超时。

这是我目前尝试过的:-

当我将应用程序或服务部署到云服务时,我有两个 Web 角色(应用程序和服务),例如http://xxxx.cloudapp.net,效果很好。

但是当我尝试在http://xxxx.cloudapp.net 的端口 8080 上部署应用程序和在端口 80 上部署服务时,并尝试浏览 - http://xxxx.cloudapp.net,它会显示服务页面。

然而,当使用 - http://xxxx.cloudapp.net:8080 浏览应用程序时,它会抛出错误 - Internet Explorer 无法在 Firefox 中显示网页/连接超时。

但是当仅将 App 部署在端口 80 上时,我的应用程序运行良好。

这里是 ServiceDefinition 文件:-

<ServiceDefinition name="AppServiceAzure" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2013-03.2.0">
  <WebRole name="MyService" vmsize="Small">
    <Sites>
      <Site name="Web">
        <Bindings>
          <Binding name="Endpoint1" endpointName="Endpoint1" />
        </Bindings>
      </Site>
    </Sites>
    <Endpoints>
      <InputEndpoint name="Endpoint1" protocol="http" port="80" />
    </Endpoints>
    <Imports>
      <Import moduleName="Diagnostics" />
    </Imports>
    <Certificates>
      <Certificate name="mycert" storeLocation="LocalMachine" storeName="My" />
    </Certificates>
  </WebRole>

  <WebRole name="MyApp" vmsize="Small">
    <Sites>
      <Site name="Web">
        <Bindings>
          <Binding name="Endpoint1" endpointName="Endpoint1" />
        </Bindings>
      </Site>
    </Sites>
    <Endpoints>
      <InputEndpoint name="Endpoint1" protocol="http" port="8080" />
    </Endpoints>
    <Imports>
      <Import moduleName="Diagnostics" />
    </Imports>
    <Certificates>
      <Certificate name="mycert" storeLocation="LocalMachine" storeName="My" />
    </Certificates>
  </WebRole>
</ServiceDefinition>

我在这里缺少什么?

【问题讨论】:

  • 我刚刚对此进行了测试,它确实有效。我创建了一个包含两个 Web 角色的云项目,每个角色都有一个单独的 Web 项目。一个在端口 80 中响应,另一个在 8080 中响应。确保在云服务中打开了两个端点。转到管理门户、云服务、仪表板,复制 INPUT ENDPOINTS 部分并用它更新您的问题(如果需要,隐藏 IP 地址)。让我们看看端口是如何映射到角色的。
  • 我也有同样的问题。这是输入端点:Role1:IP:80,Role1:IP:443,Role2:IP:8080

标签: asp.net azure cloud azure-web-roles


【解决方案1】:

每个 Windows Azure Compute 实例代表以下任一角色的虚拟服务器。

Windows Azure Compute instance
|
|_______[front-end] web server (Web role)
        |
        |
        |_____Site1
        |
        |
        |_____Site2
        |
        |
        |_____Site3 etc.

|
|
|
|_______back-end/.NET] application server (Worker role)


or

|
|
|
|_______VM

我建议两种方法: 1)在一个角色中创建多个站点。(您将获得不同的端点) 2) 或者将一个 webrole 部署到 staging 并将其他角色部署到 production。 (同样你会得到不同的端点)

【讨论】:

  • 不确定这里的第二种方法,因为您失去了将分段/生产实际用于预期目的的能力。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-03-14
  • 2011-09-17
  • 1970-01-01
相关资源
最近更新 更多