Select to view content in your preferred language

Mobile app walkthrough for WPF: CreateCache issue

561
4
03-16-2011 08:27 AM
davidrenz
Deactivated User
i am new to the mobile API and am trying to go through it to figure out what it is all about.

i am going through the walkthrough here:
http://help.arcgis.com/en/arcgismobile/10.0/apis/arcgismobile/help/index.html#/Building_your_first_A...

for some reason I am not able to create the mobile cache from a mobile map service on my GIS Server. i can see that the folder is being created in the correct location, but for some reason the cache does not get created.

the app seems to fail at this point:
ESRI.ArcGIS.Mobile.MobileServices.MobileServiceConnection.ExecuteRequest(Stream requestStream)

the code i am using is :

try
            {
                // Create an instance of MobileCache, and set StoragePath
                MobileCache mobileCache = new MobileCache();
                mobileCache.StoragePath = @"D:\temp\MapCache";

                if (mobileCache.CacheExists)
                    mobileCache.DeleteCache();
                MobileServiceConnection conn = new MobileServiceConnection();
                conn.Url = @"http://my service";
               
                // Create Mobile Cache Schema
                conn.CreateCache(mobileCache.StoragePath);

                //Open MobileCache
                mobileCache.Open();

                // Use MobileCacheSyncAgent to download data from server
                MobileCacheSyncAgent agent = new MobileCacheSyncAgent(mobileCache);
                agent.MapDocumentConnection = conn;
                agent.DownloadExtent(mobileCache.GetExtent(), 0, 0);
                // Load layers from MobileCache to Map control
                mapControl1.MapLayers.AddRange(mobileCache);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }


could there be something with the service that is not configured correctly?

if i use a local cache it works fine, just the "createCache" that is not working.

any help to get me on my way with the mobile API would be much appreciated.

thanks!
david
0 Kudos
4 Replies
AngelGonzalez
Frequent Contributor
Two things I can think of:

1) Did you enabled "Mobile Data Access" on your map service?


conn.Url = @"http://my service";


2) Did you use the full url path in your URL? Can't tell from the above line.

conn.Url = @"http://<YourServer>/arcgis/services/<YourService>/MapServer/Mobileserver";
0 Kudos
davidrenz
Deactivated User
Angel,

Thanks for the reply.

Mobile Data Access is enabled.
The full URL is in the code ... i just didn't want to include the path in the posting.

Thanks!
david
0 Kudos
MelindaFrost
Frequent Contributor
1) Did you set the custom extent in the dataframe of the mxd? Though would think you would of seen errors in your server log concerning that.
2) Can you create the mobile cache using the tools in ArcToolbox? Nice thing about using the create mobile cache tool is you can check on the GP process in the results window.
0 Kudos
SathishJaganathan
New Contributor
Hi iam new to mobile SDK development.Iam using ArcGIS 10 version.
By seeing your code @ creating catch has syntax error.
You have to pass a mobile catch object to creatcatch method. But you are passing the storagepath

I hope may below code syntax will help. Replace the below line with your existing

conn.CreateCache(mobileCache);
0 Kudos