At first, when running ActiveSync, the AutoDiscover did not work and when I tried to sync manually, I got error 0x80072F17.

The reason was pretty simple, my Windows Mobile did not trust the Root CA (Certificate Authority) that I used to issue the certificate. The solution was simple and after that I could do both AutoDiscover and sync.

Are you using Microsoft CA, go to your CA (http://localhost/certsrv/) and choose Download a CA certificate, certificate chain, or CRL. Select your CA, Base64 and Download CA Certificate. Tranfser the certificate to your mobile device with a method of your choosing, and the easiest might be to simply connect it to USB and transfer it to “My Documents” on the device.

On Windows Mobile, Start -> Programs -> File Explorer and browse and tap the certificate. It will install. You can doublecheck that it has been installed correctly in Start -> Settings -> System -> Certificate and Root Certificates tab and make sure your CA is listed.