Windows service serviceCredentials Invalid hexadecimal string format

invalid hex string
could not establish secure channel for ssl/tls with authority

I'm debugging Win service. I have added some certificates on server. Trying to find certificate by its serial number.

The piece of behaviors.config:

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

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

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).

Cannot FindByThumbprint, I'm trying to set up a sample WCF service using a self-signed certificate. Environment: Windows 7 Home Premium, Visual Studio 2010 C# Express Edition​, a project of my own and I did get the invalid hex format exception. If it still fails try to remove part of the string until you find which one causes it to fail. Note that when you remove parts of the string you would expect not to find the certificate, but at least you will see what stops from getting the hex exception. Also you can try to work on the string with other hex manipulations in .Net to check it.

Remove all the findValue="XXXXXXX" and after that write it again.. sometimes the invalid char is after findValue="??? <--- here

Self Signed Certificate-may not have a private key that is capable of , Hi, I created the self signed certificate using windows server 2012 certificate The exception message is: Invalid hexadecimal string format. /34462702/​windows-service-servicecredentials-invalid-hexadecimal-string-format This message is received when a web proxy interferes with communications between an appliance and the SecureAuth IdP cloud infrastructure.

Used finding by FindBySubjectName option. Service works good.

System.FormatException: Invalid hexadecimal string format., FormatException: Invalid hexadecimal string format.' when you're ApplyConfiguration(ServiceCredentials behavior) at System.ServiceModel  Invalid hexadecimal string format..svc' cannot be activated due to an exception during compilation. The exception message is: Invalid hexadecimal string format..] System.Runtime.AsyncResult.End(IAsyncResult result) +542. Screenshot: let me know if you want to see through screen sharing.

Invalid hexadecimal string format error received during Log Service , Why does SecureAuth use HTTP (Port 80) for Web Services? Windows JRE Download Configuration Guide · XML Generator. This time I got the exception FormatException: Invalid Hexadecimal string format. I copied the string from the snap-in again and this time I pasted it into Notepad++ to see if there were anything else hidden in the string. As it turned out there was.?34 f7 83 fc 40 f6 1d d7 1c 92 43 c9 a5 af aa 42 ba 5e 27 db

Facing issue in test connection of Async Client, The exception message is: Invalid hexadecimal string format.. ---> System. ApplyConfiguration(ServiceCredentials behavior) at System. 8 Windows service serviceCredentials Invalid hexadecimal string format Dec 25 '15-3 Windows service serviceCredentials Invalid hexadecimal string format Dec 29 '15.

WCF Services secured by x509 Certificates, Define the service in the web.config of the WCF Service project. Each of the Note: There's some special invisible Windows characters in the UI, so don't just copy the space-separated Serial Number string out or you'll get an error saying that the hexadecimal string is invalid. Type it <serviceCredentials>. The exception message is: Invalid hexadecimal string format.. ---> System.FormatException: Invalid hexadecimal string format. at System.IdentityModel.SecurityUtils.DecodeHexString(String hexString) at System.IdentityModel.Selectors.X509CertificateStore.Find(X509FindType findType, Object findValue, Boolean validOnly)

  • what do you suggest to overcome this issue? I am getting the serial number from that same dialog and it is not working.
  • paste into an editor of your choice and delete the invisible chars. Although they're invisible, you can detect their presence using the cursor.
  • What I did is to type it directly without copying and pasting, and it doesn't through and exception, but it can't find it either :S
  • I had this problem without noticing it. I opened it in Notepad++, then changed the Encoding to ASCII to see the problem...
  • Notepad++ encoding didn't work for me ... but I moved my cursor to the left of the string, and kept hitting delete till the hidden characters were removed (works in Visual Studio.)
  • This is not an answer to your question. @richaux's answer should be the accepted answer.