2011-11-08 37 views
2

私が開発したWCFサービスを追加する際に問題があります。 WCFは証明書を使用するように構成されています。それは働いていましたが、何らかの理由で今はありません。以下は、私が持っているものであるtriedLWCFサービス参照を追加する、または自分のWCFサービスにsvcutil.exeを使用する

シナリオ1:Webブラウザ上でhttps://depart.MyDomain.com/ver.svc?wsdlを閲覧するとき、それはませ XMLを示していますが、ショー

You have created a service. 

To test this service, you will need to create a client and use it to call the service. You can do this using the svcutil.exe tool from the command line with the following syntax: 

svcutil.exe http://depart.MyDomain.com/ver.svc?wsdl 

..... 
..... 

シナリオ2:

下記のsvcutil.exeを実行すると:

svcutil.exe https://depart.MyDomain.com/ver.svc?wsdl

それは生成します。

Attempting to download metadata from 'https://depart.Mydomain.com/Ver.svc?wsdl' using WS-Metadata Exchange or DISCO. 
Microsoft (R) Service Model Metadata Tool 
[Microsoft (R) Windows (R) Communication Foundation, Version 4.0.30319.1] 
Copyright (c) Microsoft Corporation. All rights reserved. 

Error: Cannot obtain Metadata from https://depart.Mydomain.com/Ver.svc?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 addr 
ess. 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://depart.Mydomain.com/Ver.svc?wsdl 

    Metadata contains a reference that cannot be resolved: 'https://depart.Mydomain.com/Ver.svc?wsdl'. 

    <?xml version="1.0" encoding="utf-16"?><Fault xmlns="http://www.w3.org/2003/05/soap-envelope"><Code><Value>Sender</Value><Subcode><Value xmlns:a="http://doc 
s.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">a:InvalidSecurity</Value></Subcode></Code><Reason><Text xml:lang="en-GB">An error occur 
red when verifying security for the message.</Text></Reason></Fault> 


HTTP GET Error 
    URI: https://depart.Mydomain.com/Ver.svc?wsdl 

    The document at the url https://depart.Mydomain.com/Ver.svc?wsdl was not recognized as a known document type. 
The error message from each known type may help you fix the problem: 
- Report from 'XML Schema' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'. 
- Report from 'DISCO Document' is 'There was an error downloading 'https://depart.Mydomain.com/Ver.svc?disco'.'. 
    - The request failed with HTTP status 403: Forbidden. 
- Report from 'https://depart.Mydomain.com/Ver.svc?wsdl' is 'The document format is not recognized (the content type is 'text/html; ch 
arset=UTF-8').'. 
- Report from 'WSDL Document' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'. 

シナリオ3:私は、Visual Studio 2010年にサービス参照を追加しようとした

、それはシナリオで同様のエラーが発生し2

以下はweb.configです。

<system.serviceModel> 
    <diagnostics> 
     <messageLogging logEntireMessage="true" logMalformedMessages="true" 
     logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="false" /> 
    </diagnostics> 
    <services> 
     <service behaviorConfiguration="VServiceBehaviour" 
       name="Ver.Service"> 
     <endpoint address="ver" listenUri="" binding="wsHttpBinding" bindingConfiguration="wshttpbindingcfg" 
        contract="Ver.IVer" bindingNamespace="http://www.MyDomain.com/ver" behaviorConfiguration ="VerEndpointBehaviour"> 
      <identity> 
      <dns value="localhost" /> 
      </identity> 
     </endpoint> 
     <endpoint address="mex" binding="mexHttpBinding" bindingConfiguration="mexhttpbinding" contract="IMetadataExchange" /> 
     <host> 
      <baseAddresses> 
      <add baseAddress="http://depart.MyDomain.com/" /> 
      </baseAddresses> 
     </host> 
     </service>  
    </services> 
    <bindings> 
     <mexHttpBinding> 
     <binding name="mexhttpbinding" /> 
     </mexHttpBinding> 
     <wsHttpBinding> 

     <binding name="wshttpbindingcfg" maxReceivedMessageSize="2000000000" sendTimeout="00:10:00"> 
      <readerQuotas maxStringContentLength="2000000000"/> 

      <security mode="TransportWithMessageCredential"> 
      <message clientCredentialType="Certificate" establishSecurityContext="False" negotiateServiceCredential="False" algorithmSuite="Default"/> 
      </security> 

     </binding> 
     </wsHttpBinding> 
    </bindings> 
    <behaviors> 
     <endpointBehaviors> 
     <behavior name="VerEndpointBehaviour"> 
      <instanceContextBehavior/> 
      <verInspectorBehavior/> 
     </behavior> 
     </endpointBehaviors> 
     <serviceBehaviors> 
     <behavior name="VServiceBehaviour"> 
      <dataContractSerializer maxItemsInObjectGraph="100000000"/> 
      <serviceMetadata httpGetEnabled="true" /> 
      <serviceDebug includeExceptionDetailInFaults="true" /> 

      <serviceCredentials> 
      <clientCertificate> 
       <authentication certificateValidationMode="PeerOrChainTrust" trustedStoreLocation="LocalMachine" mapClientCertificateToWindowsAccount="false"/> 
      </clientCertificate> 

      <serviceCertificate 
       x509FindType="FindByThumbprint" 
       findValue="xxx" 
       storeLocation="LocalMachine" 
       storeName="My"/> 
      </serviceCredentials> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    </system.serviceModel> 

事前にアドバイスをいただきありがとうございます。セキュア通信チャネルについて

答えて

関連する問題