posted on Wednesday, December 07, 2005 11:21 AM by ddshaff

SQL CE/SQL Mobile Replication and Firewalls

I recently decided to install Norton Internet Security 2006 on my development machine, moving away from the Windows XP SP2 firewall.  While this product (NIS) works great, a few days later I opened a CF2/SQL Mobile application I'm working on for a customer and attempted to merge replicate from a device to SQL Server 2005 installed on the same machine.  I received the following error: "Unable to synchronize the local database with the server."  The exception details explained "Header information is either corrupted or missing."  The CF2 application uses AddOption.CreateDatabase in the replication code to create the initial SQL Mobile database on device upon initial replication with the server.  I noticed after the error above, I ended up with a small, non-functional SQL Mobile database in my mobile app folder, but the replication clearly wasn't successful.

Whenever there is a problem with merge replication between SQL CE/SQL Mobile and the server, my first step is always to validate that I can get to the IIS virtual directory and hit the SQL CE/SQL Mobile replication dll there.  Opening Pocket Internet Explorer on device, I attempted to navigate to http://{myServerName}/{virtDirName}/sqlcesa30.dll.  When everything is configured properly, this yields a page that simply states "SQL Server Mobile Server Agent 3.0" (in the case of SQL Mobile).

So this test passed and I began to suspect perhaps the transition from the Windows XP SP2 firewall to Norton Internet Security might be my issue.  After turning off the Personal Firewall component of NIS, the problem continued to occur.  So I proceeded to hard reset my device, reinstall all 3 SQL Mobile CABs, reinstall the SQL Mobile Server Tools on my dev box, drop and recreate my publication, etc.  All to no avail.  After escalating to my friends on the Microsoft SQL Mobile team, they got me thinking that perhaps NIS has something in it other than the firewall causing this problem.  I finally completely turned off NIS (the entire package) and the problem disappears.  So here is Microsoft's description of this issue so that you can all be aware of it:

Problem:
When a device is connected to a desktop where NIS is running, then merge replication fails giving the error -"Header information is either corrupted or missing"
 
Cause:
This problem happens because Norton Internet Security strips off the Content-Length HTTP Header field from the HTTP messages. I have attached two snapshots to show this problem. NIS_Enabled.jpg is the snapshot of the HTTP trace information when Norton Internet Security is enabled and you can notice that Content-Length is replaced with dashes. This is something NIS does for any website, you can visit yahoo.com or msn.com from the device and you would still notice the content-length being stripped off. NIS does it because of certain content-length buffer overflow attacks that are possible. We rely on this content-length attribute while reading the HTTP data and since this attribute is missing, the client agent throws this error.
 
Other observations:
1. This problem does not occur when NIS is running on the IIS box
2. This problem does not occur when we run merge replication from a device emulator of a machine running NIS
 
I'm working with the SQL Mobile team to figure out a way to configure NIS so that it does not strip the Content-Length from the HTTP header.  If any of you have solved this problem, please let us know.
 
In the meantime, I have seen a number of posts in the microsoft.public.sqlserver.ce newsgroup and the new SQL Mobile forum where others have run into this issue.  At least we now know what's going on.
I'll keep you posted on the solution when one is available.
 
-Darren
 

Comments

# re: SQL CE/SQL Mobile Replication and Firewalls @ Monday, July 02, 2007 10:07 AM

Hi Darren,

I am suffering from the same problem. As you suggested I have disabled my anti virus and firewall too. Still i m getting the same error!!! could you please help me??

I am hanged up since last week!!!

Please help me out!!!

Thanks,
Paresh

Paresh