Wednesday, December 07, 2005 - Posts

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
 

SQL Mobile Downloads and Samples Available Now

It was great seeing many of you at the VS2005 Launch Event in Denver yesterday.  Microsoft just posted some fantastic resources and samples for SQL Server 2005 Mobile Edition (SQL Mobile).

Here are the downloads and a description of each:

a.    Microsoft SQL Server 2005 Mobile Edition Server Tools - The package installs the SQL Server Mobile Replications Components on the machine running the IIS server. The components are required for connecting the SQL Server Mobile database on a mobile device to SQL Server 2000 SP3a database and later versions. Link to download: http://www.microsoft.com/downloads/details.aspx?familyid=6ed0fb7e-7c05-4f59-879a-8fb619e36612&displaylang=en

 

b.    Microsoft SQL Server 2000 Service Pack 4 Replication Components – The package installs the SQL Server 2000 SP4 replication components on the machine running the IIS server. The components are required for connecting the SQL Mobile database on a mobile device to a SQL Server 2000 SP4 database. Link to download: http://www.microsoft.com/downloads/details.aspx?familyid=a0241f9c-79b1-4011-81e3-2601aa701e02&displaylang=en

 

c.     Microsoft SQL Server 2000 Service Pack 3a Replication Components – The package installs the SQL Server 2000 SP3a SQL Server 2000 SP3a replication components on the machine running the IIS server. The components are required for connecting the SQL Mobile database on a mobile device to a SQL Server 2000 SP3a database.  Link to download: http://www.microsoft.com/downloads/details.aspx?familyid=a9e0cea0-6f8d-4625-af71-fc8d671f64b6&displaylang=en

 

d.     Microsoft SQL Server 2005 Mobile Edition Device SDK – The SDK contains the product installers files for installing SQL Server Mobile on the mobile devices, and it also contains the DLL’s and Header files required for developing SQL Mobile applications on the Desktop. Link to download: http://www.microsoft.com/downloads/details.aspx?FamilyId=5BD8ABAA-5813-4DB3-B23A-24551DE2ECC1&displaylang=en

 

e.     IBuySpy Delivery 2005 Developer Toolkit Sample Application– The Toolkit is a sample e-commerce storefront to demonstrate how simple it is to create scalable applications for the Microsoft® .NET® platform by using SQL Server Mobile . Link to download: http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=7A5F64B0-4E64-4A72-A2C9-994A0C55CECD .

 

Apart from these the following are also available –

 EULA for SQL Server Mobile Device SDK: http://download.microsoft.com/download/2/4/8/2482E95D-00FD-4374-BD15-57A8C4C34444/SSMREADME.htm

ReadMe file for SQL Server Mobile Device SDK: http://download.microsoft.com/download/2/4/8/2482E95D-00FD-4374-BD15-57A8C4C34444/EULA.rtf

Help File for the SQL Server Mobile: http://download.microsoft.com/download/2/4/8/2482E95D-00FD-4374-BD15-57A8C4C34444/ssm3chm.chm

 

-Darren