Why can't adding certificate-based authentication to a leisure service hosted as a Windows service can't start the service?

I created a WCF REST service and hosted as a Windows service. I took the link from the following publication.

http://www.codeproject.com/Tips/1009004/WCF-RESTful-on-Windows-Service-Host

Now I am trying to add certificate based authentication.

I added the following section inside the configuration file. note: I followed the following msdn link to add authorization https://msdn.microsoft.com/en-us/library/ff648360.aspx

<bindings>
  <wsHttpBinding>
    <binding name="wsHttpEndpointBinding">
      <security>
        <message clientCredentialType="Certificate" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>

and

 <serviceBehaviors>
        <behavior name="ServiceBehavior">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
          <serviceCredentials>
            <serviceCertificate findValue="CN=tempCertServer" />
          </serviceCredentials>
        </behavior>
      </serviceBehaviors>

i installed the windows service and tried to start it. he gives an error.

enter image description here

I deleted the following section

<serviceBehaviors>
    <behavior name="ServiceBehavior">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="false" />
      <serviceCredentials>
        <serviceCertificate findValue="CN=tempCertServer" />
      </serviceCredentials>
    </behavior>
  </serviceBehaviors>

and the error will disappear. obviously certification didint work.

? , Windows?

+4
1
I got the solution.I made following change 

<serviceDebug includeExceptionDetailInFaults="true" />
        I saw the exception in event view logs. service was not able to find certificate,
hence not started.Again created certificate and it works. 
For creating certificate follow following link closely.

https://msdn.microsoft.com/en-us/library/ff648498.aspx

+1

Source: https://habr.com/ru/post/1660394/


All Articles