2012-11-15 9 views
6

Sono in corso la conversione di un'applicazione http in https e ssl con un certificato autofirmato.Errore: impossibile ottenere i metadati da http ......? Wsdl

per qualche motivo devo andare nel browser a localhost: ##### per avviare il servizio.

Una volta che il servizio è avviato, i test con la seguente chiamata nel prompt comman Studio 2012 visiva:

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

e ritorna con

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 /?" 

È questo detremental al mio sucesso con HTTPS?

mio config appare come tale:

<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> 

Come posso liberarmi di esso? e far funzionare i metadati e il GET funziona?

risposta

10

Posso pensare a 4 modi per affrontare questo.

  1. Installare il certificato autofirmato come autenticazione radice attendibile. MMC -> Certificati
  2. Utilizzare un browser per accedere a wsdl (fare clic sull'errore cert), salvarlo e generare direttamente wsdl.
    • inserire l'URL del WSDL nel browser e fare clic oltre l'avviso relativo al certificato in modo che si può vedere il WSDL attuale
    • Salvare il WSDL per il computer. In chrome puoi fare clic con il pulsante destro del mouse, salvare con nome.
    • In Visual Studio
      • clic destro del mouse sul progetto e selezionare "Add Service Reference"
      • Nella casella Indirizzo, immettere il percorso fisico (directory C: \ ...) del WSDL scaricato.
      • Hit Vai
  3. fuoco fino violinista e dirgli di decifrare https che installerà un cert e vi darà la possibilità di ignorare gli errori a distanza cert. Descritto qui. http://proq.blogspot.com/2012/02/svcutil-and-https.html
  4. Utilizzare una firma firmata da una radice attendibile.

Non ho visto un'opzione svcutil per ignorare errori cert.

+0

non ha aiutato, ma sarà utile per altri pepole alla ricerca della risposta in futuro –

+1

L'opzione 3 ha funzionato a meraviglia! –

+0

idem per l'opzione 3! – rhoeting

0

Ho avuto lo stesso problema. Per me ho notato che https sta usando un altro certificato che non era valido in termini di data di scadenza. Non so perché sia ​​successo. Ho cambiato il numero di porta Https e un nuovo certificato autofirmato. WCFtestClinet potrebbe connettersi al server tramite HTTPS!

Problemi correlati