0

Web サービス localhost/MyService/MyService.svc にアクセスすると、次のエラーが発生します。

サービス「SslRequireCert」の SSL 設定が、IIS の「Ssl、SslNegotiateCert」の設定と一致しません。

http://msdn.microsoft.com/en-us/library/ms731074.aspxで指定されている web.config の例に従っています。

ここに私のwcfサーバーのweb.configがあります:

<?xml version="1.0" encoding="UTF-8"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
  <appSettings />
  <system.web>
    <identity impersonate="false" />
    <roleManager enabled="true" />
    <authentication mode="Windows" />
    <customErrors mode="Off" />
    <webServices>
      <protocols>
        <add name="HttpGet" />
        <add name="HttpPost" />
      </protocols>
    </webServices>
  </system.web>
  <system.webServer>
    <directoryBrowse enabled="true" />
    <validation validateIntegratedModeConfiguration="false" />
    <security>
      <authorization>
        <remove users="*" roles="" verbs="" />
        <add accessType="Allow" users="*" roles="" />
      </authorization>
    </security>
  </system.webServer>
  <system.serviceModel>
    <services>
      <service name="AspNetSqlProviderService" behaviorConfiguration="MyServiceBehavior">
        <endpoint binding="wsHttpBinding" contract="Interface1" bindingConfiguration="CertificateWithTransportWSHttpBinding" />
        <endpoint binding="wsHttpBinding" contract="Interface2" bindingConfiguration="CertificateWithTransportWSHttpBinding" />
        <endpoint address="mex" binding="wsHttpBinding" bindingConfiguration="CertificateWithTransportWSHttpBinding" name="Metadata_Exchange" contract="IMetadataExchange" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="MyServiceBehavior">
          <serviceDebug includeExceptionDetailInFaults="True" />
          <serviceMetadata />
          <serviceCredentials>
            <clientCertificate>
              <authentication trustedStoreLocation="LocalMachine"
                               revocationMode="Online"/>
            </clientCertificate>
          </serviceCredentials>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <wsHttpBinding>
        <binding name="CertificateWithTransportWSHttpBinding">
          <security mode="Transport">
            <transport clientCredentialType="Certificate" />
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
  </system.serviceModel>
</configuration>

IIS を次のように構成しました。

  • 自己署名証明書を使用して追加された https バインディング
  • SSL 設定で、SSL を要求し、クライアント証明書を受け入れるにチェックを入れます。
  • 自己署名証明書がローカル コンピューターの信頼されたルート CA に追加されました。

.asmx サービス定義を参照して実行できますが、.svc で上記のエラーが発生します。

4

3 に答える 3

1

mex エンドポイントをコメントアウトしてみてください。それはそれを動作させるはずです

于 2012-04-19T14:50:27.317 に答える
0

私は少なくとも2〜3時間これに頭を悩ませていましたが、mexエンドポイントのコメントアウトに関する上記の応答を見落としていました。

これが私にとっての答えであることがわかったので、上記の答えを強化したかっただけです。上記の投稿のステップ7の下部にあるコメントを参照してください。

http://consultingblogs.emc.com/matthall/archive/2009/10/22/client-certificate-authorisation-with-wcf-in-development-environments.aspx

于 2012-09-28T12:19:29.360 に答える
0

プロセスは次のとおりです

  1. IIS で自己署名証明書を作成します。
  2. IIS でサイトを作成します。
  3. SSL を要求するようにサイトを設定します。
  4. IIS 7 の不具合により、バインディングで https プロトコルを選択したときに、サイトのホスト名を指定できません。このバインディングのホスト名を適切に設定するための手順がここにあります。
  5. Web構成で次のように変更します

    <wsHttpBinding> 
       <binding name="CertificateWithTransportWSHttpBinding"> 
           <security mode="Transport"> 
              <transport clientCredentialType="none" /> 
           </security> 
       </binding> 
    </wsHttpBinding>
    
    
    <serviceBehaviors>  
       <behavior name="MyServiceBehavior">  
          <serviceDebug includeExceptionDetailInFaults="True" />  
             <serviceMetadata />   
       </behavior>  
    </serviceBehaviors>  
    
  6. MEX エンドポイントで binding="wsHttpsBinding" を設定します

上記のすべてを実行すると、SSL WCF サービスが稼働しているはずです。

于 2010-11-06T01:30:12.360 に答える