Azure云服务的自定义端口号

时间:2014-07-08 22:48:25

标签: azure azure-web-roles

我有一个现有的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不允许的非标准端口?

1 个答案:

答案 0 :(得分:1)

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