2012-12-13 69 views
1

我想使用https與自定義域公開Azure雲服務,但出現錯誤:「請求的服務」https://mydomain.net/myservice。 svc'無法激活,請參閱服務器的診斷跟蹤日誌以獲取更多信息。「第二個選項「A record」:在godaddy的區域文件管理器中,我爲「@」主機配置了一個「記錄」的A記錄,該記錄的「指向」 myservice的「公共虛擬IP地址」(在Azure門戶中找到)。在我看來,我得到「服務無法啓動」的事實意味着A記錄正在工作,但我不確定。使用SSL的Azure雲服務的自定義域

關於https:我按照步驟http://www.31a2ba2a-b718-11dc-8314-0800200c9a66.com/2011/06/how-to-get-and-install-ssl-certificate.html。簡而言之:我使用我的開發機器上的CSR爲mydomain.net購買了一份來自godaddy的證書,使用友好名稱mydomain.net在我的開發機器上完成了CSR,使用該文件將其導出到mydomain.net.pfx,上傳Azure中我的雲服務的證書以及在證書中配置VS中的WebRole,並將網絡角色項目發佈到Azure。

在客戶端(WP7):

<bindings> 
    <basicHttpBinding> 
    <binding name="BasicHttpsBinding_IMyInterface" 
     maxBufferSize="2147483647" 
     maxReceivedMessageSize="2147483647"> 
     <security mode="Transport" /> 
    </binding> 
    </basicHttpBinding> 
</bindings> 
<client> 
    <endpoint name="BasicHttpsBinding_IMyInterface" 
    address="https://mydomain.net/myservice.svc" 
    contract="MyService.IMyInterface"  
    binding="basicHttpBinding" 
    bindingConfiguration="BasicHttpsBinding_IMyInterface" /> 
</client> 

注:因爲我的證書是不是一個子域,它是不是一個通配符我沒有使用CNAME。

從我的搜索,我得到的印象是這對其他人的工作,我不知道我在做什麼不同。

+0

你能RDP到實例,確認安裝了證書和用戶運行該服務有權訪問私鑰? – viperguynaz

+0

我不確定什麼,確切地說,是必要的,以滿足所述的要求,但我做了RDP,並且看到了本地計算機\個人證書和管理私鑰我驗證了NetworkService有權限(我也在IIS管理器中進行了驗證應用程序池服務正在使用的標識是NetworkService)。該證書是否應在不同的商店?本地計算機\個人是我看到它的唯一商店(我只是想到,Azure Portal證書上傳會將它放在正確的位置)。 – user1901446

+0

(不知道以上是否符合「服務可以訪問私鑰」的條件......如果沒有,你能解釋一下如何驗證它嗎?) – user1901446

回答

0

是的 - 您需要在服務器配置中指定的匹配端點。使用HTTP傳輸安全的WCF服務的web.config文件的完整示例以下(從http://msdn.microsoft.com/en-us/library/hh556232.aspx):

<?xml version="1.0"?> 
<configuration> 

    <system.web> 
    <compilation debug="true" targetFramework="4.0" /> 
    </system.web> 
    <system.serviceModel> 
    <services> 
     <service name="MySecureWCFService.Service1"> 
     <endpoint address="" 
        binding="basicHttpBinding" 
        bindingConfiguration="secureHttpBinding" 
        contract="MySecureWCFService.IService1"/> 

     <endpoint address="mex" 
        binding="mexHttpsBinding" 
        contract="IMetadataExchange" /> 
     </service> 
    </services> 
    <bindings> 
     <basicHttpBinding> 
     <binding name="secureHttpBinding"> 
      <security mode="Transport"> 
      <transport clientCredentialType="None"/> 
      </security> 
     </binding> 
     </basicHttpBinding> 
    </bindings> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior> 
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> 
      <serviceMetadata httpsGetEnabled="true"/> 
      <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> 
      <serviceDebug includeExceptionDetailInFaults="false"/> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> 
    </system.serviceModel> 
<system.webServer> 
    <modules runAllManagedModulesForAllRequests="true"/> 
    </system.webServer> 

</configuration> 
+0

你的答案有點稀疏。您是否可以添加其他信息來改進它? – ahsteele

+0

這不提供問題的答案。要批評或要求作者澄清,請在其帖子下方留言。 – ahsteele

+0

這不提供問題的答案。要批評或要求作者澄清,請在其帖子下方留言。 – ahsteele