Search code examples
c#windows-services

Windows service serviceCredentials Invalid hexadecimal string format


I'm debugging Win service. I have added some certificates on server. Trying to find certificate by its serial number. https://gyazo.com/9cdcda75e98fe7b7c35496976a5aaaeb

The piece of behaviors.config:

  <serviceCredentials>
    <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="DDBS.DDBSPasswordValidator, DDBS" />
    <serviceCertificate findValue="‎1C5411F9D38252824C2EC1CC7E5EBE3F" x509FindType="FindBySerialNumber" storeLocation="LocalMachine" storeName="My" />
  </serviceCredentials>

I got error: Service cannot be started. System.FormatException: Invalid hexadecimal string format.


Solution

  • Used finding by FindBySubjectName option. Service works good.