2012-11-15 15 views
6

Byłem w trakcie konwersji aplikacji http na https i ssl z samopodpisanym certyfikatem.Błąd: Nie można uzyskać metadanych z http ......? Wsdl

z jakiegoś powodu muszę iść w przeglądarce do localhost: #####, aby uruchomić usługę.

Gdy usługa jest uruchomiona, i przetestować go z poniższej rozmowy w Visual Studio 2012 comman wierszu:

svcutil.exe https://localhost:10201/?wsdl 

i wraca z

Error: Cannot obtain Metadata from https://localhost:10201/?wsdl 

If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455. 


WS-Metadata Exchange Error 
    URI: https://localhost:10201/?wsdl 

    Metadata contains a reference that cannot be resolved: 'https://localhost:10201/?wsdl'. 

    Could not establish trust relationship for the SSL/TLS secure channel with authority 'localhost:10201'. 

    The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. 

    The remote certificate is invalid according to the validation procedure. 


HTTP GET Error 
    URI: https://localhost:10201/?wsdl 

    There was an error downloading 'https://localhost:10201/?wsdl'. 

    The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. 

    The remote certificate is invalid according to the validation procedure. 

If you would like more help, type "svcutil /?" 

Czy to detremental do mojego sucess z HTTPS?

Mój config wygląda w następujący sposób:

<system.serviceModel> 

    <!--SERVICES--> 
    <services> 
     <service name="DuplexService.DuplexService" 
     behaviorConfiguration="sb"> 

     <endpoint 
      address="basic" 
      binding="customBinding" 
      bindingConfiguration="customDuplexBinding" 
      contract="DuplexService.Interface.IDuplexServiceContract"> 
     </endpoint> 

     <endpoint 
      address="" 
      binding="webHttpBinding" 
      behaviorConfiguration="webHttpEndpointBehavior" 
      bindingConfiguration="webHttpsBinding" 
      contract="Interface.IPolicyRetriever"> 
     </endpoint> 

     <endpoint 
      address="mex" 
      binding="mexHttpsBinding" 
      contract="IMetadataExchange"> 
     </endpoint> 

     <host> 
     <baseAddresses> 
      <add baseAddress="https://localhost:10201" /> 
     </baseAddresses> 
     </host> 
     </service> 


    </services> 


    <!--BEHAVIOURS--> 
    <behaviors> 
    <!--Policy--> 
     <endpointBehaviors> 
     <!-- For Policy Service --> 
     <behavior name="webHttpEndpointBehavior"> 
      <webHttp /> 
     </behavior> 
     </endpointBehaviors> 


<!--behaviour for all of the enpoints --> 
     <serviceBehaviors> 
     <behavior name="sb"> 
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> 
      <serviceMetadata httpsGetEnabled="true" httpsGetUrl="https://localhost:10201"/> 
      <!-- 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="true"/> 
      <!-- This will solve a bug that happens if too many items are sent at once from the gateway to the client --> 
      <dataContractSerializer maxItemsInObjectGraph="2147483647"/> 
      <serviceThrottling 
      maxConcurrentCalls="200" 
      maxConcurrentSessions="200" 
      maxConcurrentInstances="200" /> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 



    <!-- BINDINGS--> 
    <bindings> 

    <webHttpBinding> 
     <binding name="webHttpsBinding"> 
      <security mode="Transport"> 
       <transport clientCredentialType="None" /> 
      </security> 
     </binding> 
    </webHttpBinding> 

     <customBinding> 
     <binding name="customDuplexBinding"> 
      <pollingDuplex duplexMode="MultipleMessagesPerPoll" 
       maxOutputDelay="00:00:01" 
     serverPollTimeout="00:01:00" 
     inactivityTimeout="02:00:00" 
     maxPendingMessagesPerSession="2147483647" 
     maxPendingSessions="2147483647" /> 
      <binaryMessageEncoding> 
      <readerQuotas 
       maxDepth="2147483647" 
       maxStringContentLength="2147483647" 
       maxArrayLength="2147483647" 
       maxBytesPerRead="2147483647" 
       maxNameTableCharCount="2147483647" /> 
      </binaryMessageEncoding> 
      <httpsTransport 
     maxBufferSize="2147483647" 
     maxReceivedMessageSize="2147483647" 
     transferMode="StreamedResponse" /> 
     </binding> 
     </customBinding> 



    </bindings> 




    <!-- Register the binding extension from the SDK. --> 
    <extensions> 
     <bindingElementExtensions> 
     <add name="pollingDuplex" 
      type="System.ServiceModel.Configuration.PollingDuplexElement, System.ServiceModel.PollingDuplex" /> 
     </bindingElementExtensions> 
    </extensions> 
    </system.serviceModel> 

Jak mogę się go pozbyć? i sprawić, aby metadane działały, a GET działał?

Odpowiedz

10

Potrafię wymyślić 4 sposoby radzenia sobie z tym.

  1. Zainstaluj samopodpisany certyfikat jako zaufany root root. MMC -> Certyfikaty
  2. Użyj przeglądarki, aby przejść do pliku wsdl (kliknij obok błędu certyfikatu), zapisz go i wygeneruj bezpośrednio plik wsdl.
    • Put url WSDL w przeglądarce i kliknij obok ostrzeżenia certyfikatu, dzięki czemu można zobaczyć rzeczywisty WSDL
    • Zapisz WSDL do komputera. W chrome możesz kliknąć prawym przyciskiem, zapisz jako.
    • W Visual Studio
      • prawym przyciskiem myszy na projekcie i wybierz opcję „Dodaj usługi Reference”
      • W polu Adres wpisz ścieżkę fizyczną (katalogu C: \ ...) pobranego WSDL.
      • Hit Go
  3. odpalić Skrzypek i poinformować go odszyfrować https który zainstaluje cert i daje możliwość ignorowania błędów zdalnego cert. Opisano tutaj. http://proq.blogspot.com/2012/02/svcutil-and-https.html
  4. Użyj certyfikatu podpisanego przez zaufany root.

Nie widziałem opcji svcutil, aby zignorować błędy certyfikatów.

+0

nie pomogło, ale będzie pomocne dla innych osób szukających odpowiedzi w przyszłości. –

+1

Opcja 3 zadziałała! –

+0

ditto dla opcji 3! – rhoeting

0

Miałem ten sam problem. Dla mnie zauważyłem, że https używa innego certyfikatu, który był nieprawidłowy pod względem daty wygaśnięcia. Nie wiem, dlaczego tak się stało. Zmieniłem numer portu Https i nowy certyfikat samopodpisany. WCFtestClinet może połączyć się z serwerem przez HTTPS!

Powiązane problemy