2010-12-10 9 views
5

Chciałbym używać usługi WCF hostowanej w IIS (5/6) z włączoną funkcją uwierzytelniania systemu Windows i wyłączonym dostępem anonimowym. Próbowałem to zrobić, postępując zgodnie z http://msdn.microsoft.com/en-us/library/ff648431.aspx, ale pojawia się błąd informujący, że certyfikat nie jest zainstalowany. Ale nie potrzebuję SSL. Nie mam żadnych klientów oczekujących starszych usług ASMX, więc nie potrzebuję używać basicHttpBinding (a także nie jest to bezpieczne), dlatego próbowałem użyć wsHttpBinding.Hostowanie usługi WCF w IIS z uwierzytelnianiem Windows i bez anonimowego dostępu

Jak uzyskać wsHttpBinding z uwierzytelniania systemu Windows do pracy bez SSL? Jest to takie powszechne wymaganie, ale nie mogłem znaleźć żadnego rozwiązania. Czy ktoś może opublikować konfigurację dla klienta i serwera? Korzystam z klienta ASP.NET.

Moja konfiguracja poniżej. i dokładny komunikat o błędzie:

Wystąpił błąd podczas wysyłania żądania HTTP do https://mymachine/WCFTest/Service1.svc. Może to wynikać z faktu, że certyfikat serwera nie jest poprawnie skonfigurowany z HTTP.SYS w przypadku HTTPS. Może to być również spowodowane niedopasowaniem powiązania zabezpieczeń między klientem a serwerem.

Użyłem narzędzia "svcUtil" do wygenerowania klasy i konfiguracji proxy dla klienta.

server: 
    <system.serviceModel> 
     <bindings> 
      <wsHttpBinding> 
       <binding name="wsHttpEndpointBinding"> 
        <security mode="Transport"/> 
       </binding> 
      </wsHttpBinding> 
     </bindings> 
     <services> 
      <service behaviorConfiguration="WCFTest.Service1Behavior" name="WCFTest.Service1"> 
       <endpoint address="" binding="wsHttpBinding" bindingConfiguration="wsHttpEndpointBinding" name="wsHttpEndpoint" contract="WCFTest.IService1"/> 
      </service> 
     </services> 
     <behaviors> 
      <serviceBehaviors> 
       <behavior name="WCFTest.Service1Behavior"> 
        <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> 
        <serviceMetadata httpGetEnabled="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> 
    </system.serviceModel> 

client: 
    <system.serviceModel> 
    <bindings> 
     <wsHttpBinding> 
     <binding name="wsHttpEndpoint" closeTimeout="00:01:00" openTimeout="00:01:00" 
      receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" 
      transactionFlow="false" hostNameComparisonMode="StrongWildcard" 
      maxBufferPoolSize="524288" maxReceivedMessageSize="65536" 
      messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" 
      allowCookies="false"> 
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
       maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
      <reliableSession ordered="true" inactivityTimeout="00:10:00" 
       enabled="false" /> 
      <security mode="Transport"> 
      <transport clientCredentialType="Windows" proxyCredentialType="None" 
       realm="" /> 
      <message clientCredentialType="Windows" negotiateServiceCredential="true" 
       establishSecurityContext="true" /> 
      </security> 
     </binding> 
     </wsHttpBinding> 
    </bindings> 
    <client> 
     <endpoint address="https://mymachine/WCFTest/Service1.svc" 
      binding="wsHttpBinding" bindingConfiguration="wsHttpEndpoint" 
      contract="IService1" name="wsHttpEndpoint"> 
     <identity> 
      <userPrincipalName value="mymachine\ASPNET" /> 
     </identity> 
     </endpoint> 
    </client> 
    </system.serviceModel> 
+0

Opublikuj wiązanie (serwer/klient) i dokładny błąd. Nie potrzebujesz SSL do uwierzytelniania Windows. – Aliostad

+0

Twoje powiązanie wskazuje, że chcesz korzystać z zabezpieczeń Transport. Nie jestem w 100% pozytywny, ale myślę, że bezpieczeństwo transportu oznacza to samo co SSL. –

+0

jak mówi tytuł tego pytania, wszystko, czego chcę, to: usługa hosta WCF w IIS z uwierzytelnianiem Windows i bez anonimowego dostępu, jakie zmiany muszę wprowadzić? @Aliostad zasugerował pewne zmiany, ale nadal nie działa i jego komentarze zostały usunięte? – RKP

Odpowiedz

6

Skończyło się na użyciu funkcji podstawowejHttpBinding, jak wyjaśniono w artykule http://msdn.microsoft.com/en-us/library/ff648505.aspx. umieszczenie konfiguracji dla klienta i serwera poniżej, jeśli ktoś jest zainteresowany. konfiguracja klienta jest generowana za pomocą "svcutil".

server config:  
    <system.serviceModel> 
    <bindings> 
     <basicHttpBinding> 
     <binding name="BasicHttpEndpointBinding"> 
      <security mode="TransportCredentialOnly"> 
      <transport clientCredentialType="Windows" /> 
      </security> 
     </binding> 
     </basicHttpBinding> 
    </bindings> 
    <services> 
     <service behaviorConfiguration="WCFTest.Service1Behavior" name="WCFTest.Service1"> 
     <endpoint address="" binding="basicHttpBinding" 
      bindingConfiguration="BasicHttpEndpointBinding" 
      name="BasicHttpEndpoint" contract="WCFTest.IService1"> 
     </endpoint> 
     </service> 
    </services> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior name="WCFTest.Service1Behavior"> 
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> 
      <serviceMetadata httpGetEnabled="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> 
    </system.serviceModel> 

client config: 
    <system.serviceModel> 
    <bindings> 
     <basicHttpBinding> 
     <binding name="BasicHttpEndpoint" closeTimeout="00:01:00" openTimeout="00:01:00" 
      receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" 
      bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" 
      maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" 
      messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" 
      useDefaultWebProxy="true"> 
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
       maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
      <security mode="TransportCredentialOnly"> 
      <transport clientCredentialType="Windows" proxyCredentialType="None" 
       realm="" /> 
      <message clientCredentialType="UserName" algorithmSuite="Default" /> 
      </security> 
     </binding> 
     </basicHttpBinding> 
    </bindings> 
    <client> 
     <endpoint address="http://machinename/WCFTest/Service1.svc" 
      binding="basicHttpBinding" bindingConfiguration="BasicHttpEndpoint" 
      contract="IService1" name="BasicHttpEndpoint" /> 
    </client> 
    </system.serviceModel> 
Powiązane problemy