2017-02-02 2 views
0

У меня есть служба WCF работает на сервере, и я создал самозаверяющий сертификат и мои ссылки на службы его следующим образом:Как создать клиент на веб-сайте Azure для конечной точки с помощью загруженного сертификата для аутентификации?

<behaviors> 
    <serviceBehaviors> 
    <behavior name="KeypadBehavior"> 
     <serviceMetadata httpGetEnabled="true"/> 
     <serviceDebug includeExceptionDetailInFaults="false"/> 
     <serviceCredentials> 
     <serviceCertificate findValue="SELFHOSTTESTCert" x509FindType="FindBySubjectName"/> 
     </serviceCredentials> 
    </behavior> 
    </serviceBehaviors> 
</behaviors> 

Мой веб-приложение ASP.NET нужно создать клиента для администратора конечной точки:

<client> 
     <endpoint address="http://selfhosttest.example.com/Teamtime/Keypad.svc/Client" 
      binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IKeypad" 
      contract="TTAHttp.IKeypad" name="WSHttpBinding_IKeypad" /> 
     <endpoint address="http://selfhosttest.example.com/Teamtime/Keypad.svc/Admin" binding="wsHttpBinding" 
      bindingConfiguration="WSHttpBinding_IKeypadPrivilleged" contract="TTAHttp.IKeypadPrivilleged" 
      name="WSHttpBinding_IKeypadPrivilleged"> 
      <identity> 
       <certificate encodedValue="a very long unique string" /> 
      </identity> 
     </endpoint> 
    </client> 

на виртуальной машине, я могу создать частное использование администратора клиента с конечной точки.

Я пытаюсь перенести приложение на Azure WebApp. Я загрузил тот же сертификат на портале. Службы WCF не заводилась, и потребовалось некоторое возиться, прежде чем я попытался установить значения местоположения и магазина:

 <serviceCredentials> 
     <serviceCertificate storeLocation="CurrentUser" storeName="My" findValue="SELFHOSTTESTCert" x509FindType="FindBySubjectName" /> 
     </serviceCredentials> 

Теперь сервис шоу это «страница приветствия». Проблема, с которой я сейчас сталкиваюсь, - это то, что я пытаюсь настроить для клиента (см. Попытки A, B, C, D), любая попытка создания клиента выдает RTE.

<client> 
    <endpoint address="http://selfhost.example.com/TeamTime/Keypad.svc/Client" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IKeypad" contract="TTAHttp.IKeypad" name="WSHttpBinding_IKeypad" /> 
    <endpoint address="http://selfhost.example.com/TeamTime/Keypad.svc/Admin" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IKeypadPrivilleged" contract="TTAHttp.IKeypadPrivilleged" name="WSHttpBinding_IKeypadPrivilleged"> 
    <identity> 

    <!-- Option A --> 
    <!--<certificate encodedValue="a very long unique string" />--> 

    <!-- Option B --> 
    <!--<certificate encodedValue="a very long unique string" /> 
    <certificateReference 
     findValue="SELFHOSTTESTCert" 
     storeLocation="CurrentUser" 
     storeName="My" 
     x509FindType="FindBySubjectName"/>--> 

    <!-- Option C --> 
    <!--<certificateReference findValue="my thumbprint" storeLocation="CurrentUser" storeName="My" x509FindType="FindByThumbprint"/>--> 

    <!-- Option D --> 
    <!--<certificateReference storeLocation="CurrentUser" storeName="My" findValue="SELFHOSTTESTCert" x509FindType="FindBySubjectName"/>--> 

    </identity> 
</endpoint> 
</client> 

Как создать клиента на веб-сайте Azure в конечной точке с помощью загруженного сертификата?

Содержимое стека: стек сервера трассировки: в System.ServiceModel.Security.IssuanceTokenProviderBase 1.DoNegotiation(TimeSpan timeout) at System.ServiceModel.Security.SspiNegotiationTokenProvider.OnOpen(TimeSpan timeout) at System.ServiceModel.Security.TlsnegoTokenProvider.OnOpen(TimeSpan timeout) at System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpen(TimeSpan timeout) at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) at System.ServiceModel.Security.CommunicationObjectSecurityTokenProvider.Open(TimeSpan timeout) at System.ServiceModel.Security.SymmetricSecurityProtocol.OnOpen(TimeSpan timeout) at System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpen(TimeSpan timeout) at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) at System.ServiceModel.Channels.SecurityChannelFactory 1.ClientSecurityChannel 1.OnOpen(TimeSpan timeout) at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) at System.ServiceModel.Security.SecuritySessionSecurityTokenProvider.DoOperation(SecuritySessionOperation operation, EndpointAddress target, Uri via, SecurityToken currentToken, TimeSpan timeout) at System.ServiceModel.Security.SecuritySessionSecurityTokenProvider.GetTokenCore(TimeSpan timeout) at System.IdentityModel.Selectors.SecurityTokenProvider.GetToken(TimeSpan timeout) at System.ServiceModel.Security.SecuritySessionClientSettings 1.ClientSecuritySessionChannel.OnOpen (TimeSpan тайм-аут) в System.ServiceModel.Channels.CommunicationObject.Open (TimeSpan тайм-аута) в System.ServiceModel.Channels.ReliableChannelBinder 1.ChannelSynchronizer.SyncWaiter.TryGetChannel() at System.ServiceModel.Channels.ReliableChannelBinder 1.ChannelSynchronizer.SyncWaiter.TryWait (TChannel & канал) на System.ServiceModel.Channels.ReliableChannelBinder 1.ChannelSynchronizer.TryGetChannel(Boolean canGetChannel, Boolean canCauseFault, TimeSpan timeout, MaskingMode maskingMode, TChannel& channel) at System.ServiceModel.Channels.ClientReliableChannelBinder 1.Request (сообщение Message, TimeSpan таймаута, maskingMode maskingMode) в System.ServiceModel.Channels.RequestReliableRequestor .OnRequest (Запрос сообщения, TimeSpan timeout, Boolean last) в System.ServiceModel.Channels.ReliableRequestor.Request (TimeSpan тайм-аут) в System.ServiceModel.Channels.ClientReliableSession.Open (тайм-аут TimeSpan) в System.ServiceModel.Channels.ReliableRequestSessionChannel.OnOpen (тайм-аут TimeSpan) в System.ServiceModel.Channels.CommunicationObject.Open (тайм-аут TimeSpan) в System.ServiceModel.Channels .ServiceChannel.OnOpen (тайм-аут TimeSpan) в System.ServiceModel.Channels.CommunicationObject.Open (тайм-аут TimeSpan) в System.ServiceModel.Channels.ServiceChannel.CallOpenOnce.System.ServiceModel.Channels.ServiceChannel.ICallOnce.Call (канал ServiceChannel, тайм-аут TimeSpan) в System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce (тайм-аут TimeSpan, каскад CallOnceManager) в System.ServiceModel.Channels.ServiceChannel.Call (String action, Boolean oneway, ProxyOperationRuntime operation, Object [] ins, Object [] outs, TimeSpan) в System.ServiceModel.Channels.ServiceChannelProxy.InvokeService (метод IMethodCallMessageCall, ProxyOperationRuntime) в System.ServiceModel.Channels.Ser viceChannelProxy.Invoke (сообщение с сообщением об ошибке) Исключение, указанное в [0]: в System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage (IMessage reqMsg, IMessage retMsg) в System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke (MessageData & msgData, Int32 типа) в TTAHttp.IKeypadPrivilleged.ClearTokens (String MeetingID) на LaunchTeamTimeClient.Page_Load (отправитель объекта, EventArgs е)

ответ

0

кажется, что вам нужно добавить WEBSITE_LOAD_CERTIFICATES с отпечатком сертификата в appsetting WebApp.Если это так, попробуйте следовать блогу Using Certificates in Azure Websites Applications, чтобы добавить его. Ниже приводится текст из блога.

Добавление настроек приложения с именем WEBSITE_LOAD_CERTIFICATES с его значением, установленным на отпечаток сертификата, сделает его доступным для вашего веб-приложения. Вы можете иметь несколько значений отпечатка пальца, разделенных запятыми, или можете установить это значение в «*» (без кавычек), и в этом случае все ваши сертификаты будут загружены в ваше личное хранилище сертификатов ваших веб-приложений.

+0

Ой, забыл упомянуть, что я уже сделал это. – WhiskerBiscuit

+0

Если вы хотите установить самозаверяющий сертификат CA в Azure WebApp, который не разрешен. Более подробную информацию см. В другом [SO thread] (http://stackoverflow.com/questions/41776109/installing-certificates-to-the-trusted-root-certificate-store-on-azure-web-apps?answertab= активная # вкладка-вверху). –

Смежные вопросы