【问题标题】:Custom port number for Azure cloud serviceAzure 云服务的自定义端口号
【发布时间】:2014-07-08 22:48:24
【问题描述】:

我有一个现有的 Azure 云服务,它提供 http 和 https 端点。就目前而言,一切都运行良好。最近,另一个小组要求我在一个特殊端口上添加一个 SSL 端点,以支持他们正在做的事情或其他事情。因此,我在服务定义中添加了一个额外的端点并重新部署。这是我的 csdef:

<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="MyService" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2013-10.2.2">
<WebRole name="MyService.WebAPI" vmsize="Large">
    <Sites>
      <Site name="Web">
        <Bindings>
          <Binding name="Endpoint1" endpointName="NonSSL Endpoint" />
          <Binding name="Endpoint2" endpointName="SSL Endpoint" />
          <Binding name="Endpoint3" endpointName="SSL 5200" />
        </Bindings>
      </Site>
    </Sites>
    <LocalResources>
      <LocalStorage name="localConfigStore" sizeInMB="1" />
    </LocalResources>
    <Endpoints>
      <InputEndpoint name="NonSSL Endpoint" protocol="http" port="80" />
      <InputEndpoint name="SSL Endpoint" protocol="https" port="443" certificate="mycert" />
      <InternalEndpoint name="InternalHttpIn" protocol="http" />
      <InputEndpoint name="SSL 5200" protocol="https" port="5200" certificate="mycert" />
    </Endpoints>
    <Imports>
      <Import moduleName="Diagnostics" />
    </Imports>
    <ConfigurationSettings>
      <Setting name="LocalStorageAccount" />
    </ConfigurationSettings>
    <Certificates>
      <Certificate name="mycert" storeLocation="LocalMachine" storeName="My" />
    </Certificates>
  </WebRole>
</ServiceDefinition>

这部署得很好,我可以像往常一样在端口 80 和 443 上查询服务,但是查询端口 5200 会立即导致连接被拒绝错误:

PS C:\Users\user> curl -k -v https://myservice.cloudapp.net:5200/api/health
* Hostname was NOT found in DNS cache
* Adding handle: conn: 0x4ae0a0
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x4ae0a0) send_pipe: 1, recv_pipe: 0
*   Trying x.x.x.x...
* connect to x.x.x.x port 5200 failed: Connection refused
* Failed to connect to myservice.cloudapp.net port 5200: Connection refused
* Closing connection 0
curl: (7) Failed to connect to myservice.cloudapp.net port 5200: Connection refused
PS C:\Users\user>

如果我在 Azure 管理控制台中查看已部署的服务,我会看到所有三个端点,所以我认为我的配置中没有出现严重错误...我需要做些什么才能打开那个港口到外面的世界?还是 Azure 不允许使用非标准端口?

【问题讨论】:

  • 如果您从该端口删除 SSL 并转到 http,会发生什么情况?可以卷曲到其他端点吗?
  • 是的,我可以很好地访问其他两个端点。我尝试将额外的端点切换到标准 http,它似乎可以工作,这不是我所期望的......

标签: azure azure-web-roles


【解决方案1】:

经过几次重新部署后,它突然开始工作。我猜有一些防火墙更改需要一段时间才能传播并开始允许 5200 上的流量。

【讨论】:

    猜你喜欢
    • 2017-04-23
    • 2013-10-03
    • 1970-01-01
    • 2020-05-17
    • 2015-06-17
    • 2019-01-19
    • 1970-01-01
    • 2015-11-04
    • 1970-01-01
    相关资源
    最近更新 更多