MakiG007

Getting "Invalid file or corrupted file" Exception when Opening Map Cache after Sync

Discussion created by MakiG007 on Mar 23, 2012
Latest reply on Apr 5, 2012 by MakiG007
Ok, So I have this Windows Mobile 6 ArcGIS Mobile 10 SDK application that I can get to run wonderfully as long as I have created a mobile cache and physically placed it onto the device.

But whenever I try to use a MobileServiceConnection, MobileCache, and MobileCacheSyncAgent to Synchronize my map with the MapServer on my ArcGIS Server I get a "Invalid file or corrupted file" exception as soon as I try to open the MobileCache.

I checked the ArcGIS Server logs and it appears to be receiving the request, and processing it correctly:
Level Message         Time   Configuration
INFO3 Server Context released.      2012-03-23 17:40:37 Facilities.MapServer 
INFO2 Binary request successfully processed. Response size is 2136 bytes. 2012-03-23 17:40:37 Facilities.MapServer 
DEBUG MobileSync: Get Schema [elapsed time = 0.001189 seconds].  2012-03-23 17:40:37 Facilities.MapServer 
DEBUG Schema Checksum 2197403820.      2012-03-23 17:40:37 Facilities.MapServer 
INFO2 Binary request received. Request size is 5 bytes.   2012-03-23 17:40:37 Facilities.MapServer 
INFO3 Server Context created.       2012-03-23 17:40:37 Facilities.MapServer


Here is my
            try
            {
                if (!Utility.CheckURLConnection(AppProps.MobileMapServiceURL + "?wsdl"))
                {
                    MessageBox.Show("Not able to connect to map server.");
                }
                mobileMapServiceCache.StoragePath = mobileMapServiceCachePath;
                mobileMapServiceCache.DeleteCache();
                mobileMapServiceConn.Url = AppProps.MobileMapServiceURL;
                MobileCacheSyncAgent mobileSync = new MobileCacheSyncAgent(mobileMapServiceCache, mobileMapServiceConn);
                if (mobileSync.IsValid)
                {
                    mobileMapServiceConn.CreateCache(mobileMapServiceCache);
                    //mobileSync.StateChanged += new EventHandler(mobileSync_StateChanged);
                    //mobileSync.ProgressChanged += new EventHandler<MobileCacheSyncAgentProgressEventArgs>(mobileSync_ProgressChanged);
                    SyncResults mobileResults = mobileSync.Synchronize();
                    MessageBox.Show(mobileResults.DataSizeReceived.ToString());
                    mobileMapServiceCache.Open();
                    map1.DataSources.Add(mobileMapServiceCache);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Cannot synchronize with the mobile map service: " + ex.Message);
            }


I even tried adding event handlers to the MobileCacheSyncAgent ... but they were never called ...

The MessageBox right before the mobileMapServiceCache.Open(); call always return 0 ...

back in 9.3.1 all we had to do was use a MobileService ... am I doing something wrong? Please help!

Thanks!!

Outcomes