c# - WCF showing 403 Forbidden using SSL and client certificates -


we having problem wcf - getting error below when trying connect. there tons of suggestions various configurations, having tried them use help.

we using https transport security, using real ssl certificate got godaddy. seems installed , working when browse web pages on site. no authentication, can connect our wcf service.

for authentication, using client certificates created ourselves. these client certificates working fine before switched https, when using message security self-signed server certificate (which pain because had clients install server certificate).

error http request forbidden client authentication scheme 'anonymous'. inner exception: remote server returned error: (403) forbidden

server configuration file

<system.servicemodel>   <bindings>     <wshttpbinding>       <binding name="newbinding0">         <security mode="transport">           <transport clientcredentialtype="certificate" />         </security>       </binding>     </wshttpbinding>   </bindings>   <services>     <service name="wcfservice1.service1">       <endpoint address="" binding="wshttpbinding" bindingconfiguration="newbinding0" contract="wcfservice1.iservice1" />     </service>   </services>   <behaviors>     <servicebehaviors>       <behavior name="">         <servicemetadata httpgetenabled="true" httpsgetenabled="true" />         <servicedebug includeexceptiondetailinfaults="true" />         <servicecredentials>           <clientcertificate>             <authentication certificatevalidationmode="peertrust" />           </clientcertificate>           <servicecertificate findvalue="....." x509findtype="findbythumbprint" />         </servicecredentials>       </behavior>     </servicebehaviors>   </behaviors>   <protocolmapping>     <add scheme="https" binding="wshttpbinding" bindingconfiguration="newbinding0" />   </protocolmapping>   <servicehostingenvironment aspnetcompatibilityenabled="true" multiplesitebindingsenabled="true" /> </system.servicemodel> 

client configuration file

<system.servicemodel>     <behaviors>         <endpointbehaviors>             <behavior name="newbehavior0">                 <clientcredentials>                     <clientcertificate findvalue="customuser1"                         storename="trustedpeople" x509findtype="findbysubjectname" />                 </clientcredentials>             </behavior>         </endpointbehaviors>     </behaviors>     <bindings>         <wshttpbinding>             <binding name="newbinding0">                 <security mode="transport">                     <transport clientcredentialtype="certificate" />                 </security>             </binding>         </wshttpbinding>     </bindings>     <client>         <endpoint address="https://www.insertoursitename.com/wcfservice1/service1.svc"             behaviorconfiguration="newbehavior0" binding="wshttpbinding"             bindingconfiguration="newbinding0" contract="servicereference1.iservice1"             name="wshttpbinding_iservice1" />     </client> </system.servicemodel> 

my problem similar yours, , i'll describe scenario before answering question.

  1. created simple wcf service (using custom binding, that's irrelevant).
  2. created self-signed rootca using makecert, , generated 2 certs tempcertserver.cer used ssl encryption, configure iis require https, etc. --> tested part, worked ok browser different computer.
  3. the second cert tempcertclient.cer used client-cert presented iis, configure iis require client-cert, etc. --> tested part browser (best use ie since can clear ssl state). prompt choose client cert, never connects, error same per question: "the http request forbidden client authentication scheme 'anonymous'. inner exception: remote server returned error: (403) forbidden."
  4. replaced tempcertclient proper cert (from known ca), there no issue, connection established , wcf page shown; no matter tried self-signed client cert, getting above error.

wasted whole day++ trying various settings, reading blogs on registry changes, placing cert server-side under different cert stores, changing config file settings, etc, no resolution.

the answer simple, inspect localcomputer\trusted root certification authorities server-side, , remove non-root ca's (i.e. should not there, issuedto not equals issuedby)

the client-cert did not need installed on server, root ca can validate has installed in localcomputer\trusted root certification authorities server-side.


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -