c# - IIS hosted WCF with SSL security -"The HTTP request was forbidden with client authentication scheme 'Anonymous'" error -


i trying host wcf on iis using transport security. found tutorial , follow instructions : http://robbincremers.me/2011/12/27/wcf-transport-security-and-client-certificate-authentication-with-self-signed-certificates/. getting "the http request forbidden client authentication scheme 'anonymous'". how can handle it?

what did far is:

  1. i created self-signed root authority certificate explained here.

    makecert -n "cn=tempca" -r -sv tempca.pvk tempca.cer

  2. created new server certificate signed root authority certificate

    makecert -sk signedbyca -iv tempca.pvk -n "cn=localhost" -ic tempca.cer localhost.cer -sr localmachine -ss my

  3. created new client certificate signed root authority certificate

    makecert -sk signedbyca -iv tempca.pvk -n "cn=clientcert" -ic tempca.cer clientcert.cer -sr localmachine -ss my

  4. added ca trusted root certificate

    enter image description here

  5. added these certificates personal --> certificates enter image description here

  6. added client certificate trusted people enter image description here

  7. everything looks ok enter image description here

  8. created simple wcf application. added iis enter image description here

  9. adjust security settings enter image description here

  10. this service web.config file

> <?xml version="1.0"?> <configuration>   <system.web> >     <compilation debug="true" targetframework="4.5" /> >     <httpruntime targetframework="4.5"/>   </system.web>   <system.servicemodel> >     <bindings> >       <basichttpbinding> >         <binding name="employeebindingconfig"> >           <security mode="transport"> >             <transport clientcredentialtype="certificate" /> >           </security> >         </binding> >       </basichttpbinding> >     </bindings> >     <behaviors> >       <servicebehaviors> >         <behavior name="employeeservicebehavior"> >           <servicemetadata httpsgetenabled="true"/> >           <servicedebug includeexceptiondetailinfaults="true"/> >           <servicecredentials> >             <clientcertificate> >               <authentication certificatevalidationmode="peerorchaintrust" > trustedstorelocation="localmachine" /> >             </clientcertificate> >           </servicecredentials> >         </behavior> >       </servicebehaviors> >     </behaviors> >     <services> >       <service >         behaviorconfiguration="employeeservicebehavior" >         name="wcf.tutorial.transportsecurity.servicenew.employeeservice"> >         <host> >           <baseaddresses> >             <add baseaddress="https://localhost/wcf.tutorial.transportsecurity.servicenew"/> >           </baseaddresses> >         </host> >         <endpoint address="employeeservice" >                   binding="basichttpbinding" >                   bindingconfiguration="employeebindingconfig" >                   contract="wcf.tutorial.transportsecurity.servicenew.iemployeeservice" > /> >         <endpoint >            address="mex" >            binding="mexhttpsbinding" >            contract="imetadataexchange" /> >       </service> >     </services>   </system.servicemodel>   <system.webserver> >     <modules runallmanagedmodulesforallrequests="true"/>   </system.webserver> </configuration> 
  1. this client app.config
>     <?xml version="1.0" encoding="utf-8" ?> >     <configuration> >         <startup>  >             <supportedruntime version="v4.0" sku=".netframework,version=v4.5" /> >         </startup> >       <system.servicemodel> >         <behaviors> >           <endpointbehaviors> >             <behavior name="employeeendpointbehaviour"> >               <clientcredentials> >                 <clientcertificate storelocation="localmachine" storename="my" x509findtype="findbysubjectname" findvalue="omer-hp"/> >               </clientcredentials> >             </behavior> >           </endpointbehaviors> >         </behaviors> >         <bindings> >           <basichttpbinding> >             <binding name="employeebindingconfig"> >               <security mode="transport"> >                 <transport clientcredentialtype="certificate" /> >               </security> >             </binding> >           </basichttpbinding> >         </bindings> >         <client> >           <endpoint address="https://localhost/wcf.tutorial.transportsecurity.servicenew/employeeservice.svc" >                     binding="basichttpbinding" bindingconfiguration="employeebindingconfig" >             contract="wcf.tutorial.transportsecurity.servicenew.iemployeeservice" > name="serviceendpoint" > behaviorconfiguration="employeeendpointbehaviour"/> >         </client> >       </system.servicemodel> >     </configuration> 
  1. this client code , error enter image description here

my question how can pass error? need help.

at least issue has been found. when looked inside windows event log saw error

when asking client authentication, server sends list of trusted certificate authorities client. client uses list choose client certificate trusted server. currently, server trusts many certificate authorities list has grown long. list has been truncated. administrator of machine should review certificate authorities trusted client authentication , remove not need trusted.

i backed certificates , deleted them. after operation program works.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -