2
我有一個現有的Azure雲服務,它提供http和https端點。一切工作都很順利。我最近被另一個組織要求在特殊端口上添加一個SSL端點以支持他們正在做的一些事情。所以,我在服務定義中添加了一個額外的端點並進行了重新部署。這裏是我的csdef現在:Azure雲服務的自定義端口號
<?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,會發生什麼情況?你可以捲曲到其他端點嗎? – trailmax
是的,我可以很好地打另外兩個端點。我嘗試將額外的端點切換到標準的http,它似乎工作,這不是我所期望的... – superstator