ActiveSync doesn't sync

With some customized configurations of IIS, ActiveSync won't work properly but gives no or useless errors.

For a while we've been trying to get ActiveSync going at work. The clients would initially connect, but then loose connection and get no notification about new emails. On the server side, there were really no errors, and when there were errors, they were pretty useless, yielding no useful information other than wild guesses and try-end-error reports of other people.

While there seem to be many problems getting ActiveSync working, starting with the authentication settings (ActiveSync requires no Form based authentication on certain IIS "web sites", but not on all as many resources claim), through permissions (in the virtual "web site" sense), and ending with as odd settings as HTTP headers (our case).

After numerous tries of poking and prodding, we finally started getting errors as follows in the event log:

Event Type: Error
Event Source:   Server ActiveSync
Event Category: None
Event ID:   3005
Date:       7/29/2008
Time:       11:38:11 AM
User:       DOMAIN\user
Computer:   SERVERNAME
Description:
Unexpected Exchange mailbox Server error: Server: [server.domain.local]
User: [user@domain.com] HTTP status code: [400]. Verify that the Exchange
mailbox Server is working correctly.

While not very useful, it helped us to track down the errors to HTTP headers. It turns out ActiveSync is picky about the HTTP headers and doesn't particularly recognize the HTTP 1.1 Host header, when they are forced on the IIS web sites.

The solution turned out being as simple as going into properties of the Default Web Site, clicking the Advanced button in the Website tab, and adding a blank host (use All Unassigned for IP Address, 80 for Port , and leave Host Header Value blank) into the Multiple identities list.

Viola, it all works. I have used lot of resources, forums, and official documentation on the web, but there were too many and most of them useless to mention any. There have also been few other things I had to change in settings of some sites, but unfortunately I don't recall what they are, as this whole process was spread over several weeks performed in spare time.