WCF + + Validation

Source: Internet
Author: User

1. Creation of certificates

MAKECERT.EXE-SR localmachine-ss my-a sha1-n Cn=parkingserver-sky Exchange-

Note: After the certificate is finished, the corresponding certificate Read permission is also configured.

WCF takes the certificates of the certificate, and the server and client are modified accordingly.

2. Modification of the service side

Behavior node:

        <Behaviorname= "Custombehavior">          <Servicemetadatahttpgetenabled= "true" />          <ServicedebugIncludeexceptiondetailinfaults= "true" />          <ServiceCredentials>            <ClientCertificate>              <AuthenticationCertificatevalidationmode= "None" />            </ClientCertificate>            <servicecertificatefindvalue= "Parkingserver"storelocation= "LocalMachine"StoreName= "My"X509FindType= "Findbysubjectname" />          </ServiceCredentials>        </Behavior>

Binding node

      <Wshttpbinding>        <bindingname= "Customwshttpbinding">          <SecurityMode= "Message">            <messageclientCredentialType= "Certificate"/>          </Security>        </binding>      </Wshttpbinding>

Service node

    <Servicename= "Wcfservice1.service1"behaviorconfiguration= "Custombehavior">        <EndpointAddress=""binding= "Wshttpbinding"bindingconfiguration= "Customwshttpbinding"Contract= "Wcfservice1.iservice1">          <Identity>            <DNSvalue= "Parkingserver" />          </Identity>        </Endpoint>        <EndpointAddress= "Mex"binding= "mexHttpBinding"Contract= "IMetadataExchange" />      </Service>

3. Client-side modifications

Client-endpoint node

      <EndpointAddress= "Http://localhost:60909/Service2.svc"binding= "BasicHttpBinding"behaviorconfiguration= "CustomBehavior2"bindingconfiguration= "Basichttpbinding_iservice2"Contract= "Servicereference2.iservice2"name= "Basichttpbinding_iservice2">        <Identity>          <DNSvalue= "Parkingserver" />        </Identity>      </Endpoint>

Bindings node

      <BasicHttpBinding>        <bindingname= "Basichttpbinding_iservice2">          <SecurityMode= "Message">            <messageclientCredentialType= "Certificate" />          </Security>        </binding>      </BasicHttpBinding>

Behavior node

Behavior nodes, wshttpbindings and basichttpbindings have different binding content. Basichttpbindings more than one defaultcertificate configuration

Basichttpbindings

        <Behaviorname= "CustomBehavior2">          <ClientCredentials>            <ClientCertificatefindvalue= "Zoesoft"X509FindType= "Findbysubjectname"storelocation= "LocalMachine"StoreName= "My"/>            <servicecertificate>              <AuthenticationCertificatevalidationmode= "None"/>              <defaultcertificatefindvalue= "Parkingserver"StoreName= "My"storelocation= "LocalMachine"X509FindType= "Findbysubjectname"/>            </servicecertificate>          </ClientCredentials>        </Behavior>

Wshttpbindings

        <Behaviorname= "Custombehavior">          <ClientCredentials>            <ClientCertificatefindvalue= "Zoesoft"X509FindType= "Findbysubjectname"storelocation= "LocalMachine"StoreName= "My"/>            <servicecertificate>              <AuthenticationCertificatevalidationmode= "None"/>            </servicecertificate>          </ClientCredentials>        </Behavior>

Reference:

WCF Development Framework formation journey--How to implement X509 certificate encryption

Invoke WCF service from Java clients with authentication (CERTIFICATE) Java client calls WCF services requires secure authentication

WCF + + Validation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.