superstator
superstator

Reputation: 3208

Custom port number for Azure cloud service

I have an existing Azure cloud service which provides http and https endpoints. Everything is working well as far as that goes. I've recently been asked by another group to add an SSL endpoint on a special port to support something or other they're doing on their end. So, I added an extra endpoint in the service definition and redeployed. Here's my csdef now:

<?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>

This deploys fine, and I'm able to query the service as usual on ports 80 and 443, but querying port 5200 gets me an immediate connection refused error:

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>

If I look at the deployed service in the Azure management console I see all three endpoints, so I don't think I've made an egregious error in my config... Is there something else I need to do to open that port to the outside world? Or are nonstandard ports not allowed by Azure?

Upvotes: 2

Views: 1221

Answers (1)

superstator
superstator

Reputation: 3208

After a couple redeploys it has suddenly started working. I'm guessing there was some firewalling change that took a while to propogate and begin allowing traffic on 5200.

Upvotes: 1

Related Questions