The first issue I ran into when trying to create this project is which Visual Studio version should I use. After searching thru the web from the best that I can see I the newest version that still supports winCE is VS2008, so I started with this version. The first step is to make sure you install all the prerequisites as listed below:
Prerequisites
To complete this walk through you must:
- Install the Northwind sample database on a Microsoft SQL Server or Microsoft SQL Server Express Edition database. The local database cache on the device emulator will synchronize with this database. For more information, see How to: Install Sample Databases.
- Install Windows Mobile Device Center (Windows Vista) or ActiveSync.
- Install Visual Studio 2008 Service Pack 1.
- Install Microsoft Synchronization Services for ADO.NET.
- Install Microsoft SQL Server Compact 3.5 Service Pack 1 for Windows Mobile.
Microsoft.Synchronization.Data.
This would give the following cryptic error unhandled Message="TargetInvocationException" and I had to seach lots of articles to finally figure this out. Once I added service pack 1 that error went away.
After fixing that I then got a client error in Microsoft.Synchronization.Data.SyncStatistics syncStats = syncAgent.Synchronize(); for the following ArgumentException error on the client side.
The first thing to do is see if IE can connect to the WCF service to ensure it is still working. To do this I set theMiddleTierServiceLibrary as the startup project and then select the start without debugging option in the Debug menu. This will bring up the deployment window where I will just select cancel and then in the deployment errors click continue. Figure 1 shows the WCF screen and from here I just copy the http://10.83.4.96:8080/NorthwindCacheSyncService/ from the WC F test client and paste it in IE where you should see the page as listed in figure 2. From this I now know that the WCF service is working and a client can connect to it.
Figure 1
Figure 2
Once I know a client can connect I then set SmartDeviceSyncClient as the start up project. Then I just select start debugging from the Debug menu option. Once the code runs I will get the ArgumentException error so I ignore the error and let the code run. My next step is to try to connect thru IE on the PocketPC emulator with the saem address as listed above. As Shown below you can see that connection files and I cannot connect to the WCF service from the PocketPC.
Figure 3
No back to reading more articles on this problem and I come up with this. How is the PocketPC able to establish a connection to the service. Some how it has to have a enet connection and know how to resolve it to an IP address. So the way to do this is in VS IDE Tools->Device Emulator Manager. Once this is selected it bring up a panel with all the emulation devices. On this screen I selected window Mobile 5.0 and right click on it. The right click option and select connect.
Figure 4
Once the device is connected you should see the phone and active sync screens pop up and establish a connect. Now the PocketPC has a ENET connect thru active sync and it should be able to connect to WCF service. But in my case using http://10.83.4.96:8080/NorthwindCacheSyncService/ still did not connect with the same connection error. So the next thing I tried was to use ppp_peer:8080 as the connection name as this is the default name for the emulated device and behold it was able to connect. Great now I know I can connect on ppp_peer with IE, but what about the client application.
Figure 5
string
Figure 6
So from this I am not sure what caused it to start working, but I tested it several times and it seams to run and connect correctly now. I would assume that forcing a DNS look up made the look up table instantiate the connection. I will test this further in another article, but for not it works.