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.
Remove all the findValue="XXXXXXX" and after that write it again.. sometimes the invalid char is after findValue="??? <--- here
From Jan Angelovič on MSDN Forum:
If you cut and paste the [Serial Number or Thumbprint] from the common certificate dialog, it is copied in UNICODE (UTF-16LE) encoding with special invisible control characters (0xFF and 0xFE aka “Byte order mark“) on the beginning of the string.
Personally, I saw this with the thumbprint; cut & paste from the dialog into Visual Studio kept 2 non-displayed characters (that could be "stepped through" with the cursor and deleted).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With