I'm trying to reference a simple map service published to ArcGIS Server (running on same machine as development) which has just a shapefile. I'm using WPF and version 100.1 of the runtime. Below is the code in the constructor of the startup window in my .NET WPF project. When the app opens I don't see any features. The service seems to be running fine as I can consume it in ArcMap. I don't get any exceptions and nothing shows in server logs. Any ideas? Thanks in advance,
Chad
Snippet
var uri = new Uri("https://localhost:6443/arcgis/rest/services/MyMapService/MapServer"); ArcGISMapImageLayer layer = new ArcGISMapImageLayer(uri); Map map = new Map(SpatialReference.Create(4326)); map.OperationalLayers.Add(layer); MyMap.Map = map;
It's likely the Layers/Map are not loaded.
As a rule you should not run async code in a constructor but as a way to check if the issue is that things need to get loaded something like this should work
//this is bad code
var uri = new Uri("https://localhost:6443/arcgis/rest/services/MyMapService/MapServer");
ArcGISMapImageLayer layer = new ArcGISMapImageLayer(uri);
Task t = Task.Run(() => layer.LoadAsync());
t.Wait();
Map map = new Map(SpatialReference.Create(4326));
map.OperationalLayers.Add(layer);
t = Task.Run(() => map.LoadAsync());
t.Wait();
MyMap.Map = map;
Thanks much. I think that got me on the right track, but I now get an error saying the remote certificate isn't valid. I'm just running Server locally so I assume I need to get a certificate established on my machine next.