Select to view content in your preferred language

Re-adding Bing Service produces "Could not find endpoint element with name....

967
2
Jump to solution
05-20-2012 12:52 PM
NicoleSchmidt
Emerging Contributor
I have a tool that lets users swap a base map.  If I start the map loaded with a tiled map layer, then switch to the Bing base map layer I get an error message when adding the Bing base map layer to my Layers collection.

The error message is:
Could not find endpoint element with name 'BasicHttpBinding_IImageryService' and contract 'ImageryService.IImageryService' in the ServiceModel client configuration section. 

It works fine if I load Bing right off the bat.  It works fine switching between different Bing map types, and works fine switching from Bing to my custom tiled service.  I only get this exception when switching from a custom tiled service to Bing.

This is using the SL 3.0 RC version.  I have not tried it in any previous versions.

    private void SwapTheBaseMap(bool bResetExtent, ESRI.ArcGIS.Client.Bing.TileLayer.LayerType layertypeEnum, string token)   {     ViewableMapServices.Clear();     if (bResetExtent) ZoomToGeometry = null; //Tell the map to clear its extent using a custom extension on the Map class     //Add Base Map    if (token != null)    {      ESRI.ArcGIS.Client.Bing.TileLayer tileLayer = new ESRI.ArcGIS.Client.Bing.TileLayer()     {      ID = "BingLayer",      LayerStyle = layertypeEnum,      ServerType = ESRI.ArcGIS.Client.Bing.ServerType.Production,      Token = token     };     tileLayer.InitializationFailed += (o, e) =>     {      //don't throw an exception, we log it instead     };      ViewableMapServices.Add(tileLayer); //this is where it throws the error    }     //Call a function that re-adds non base map layers    AddOperationalLayers();     }


Has anyone seen this exception before?  I can provide the stack trace if that is helpful.  This is the last non-Microsoft call in the stack trace for the error:
  ESRI.ArcGIS.Client.Bing!ESRI.ArcGIS.Client.Bing.ImageryService.ImageryServiceClient.ImageryServiceClient(string endpointConfigurationName)

Thanks
0 Kudos
1 Solution

Accepted Solutions
JenniferNery
Esri Regular Contributor
I have not seen this particular exception but I think this might be a related thread: http://forums.arcgis.com/threads/34564-Change-map-based-on-runtime-with-Silverlight-API. When replacing base layer, since it defines the Map.Extent and SpatialReference, you can unset them before before replacing with new layer.

View solution in original post

0 Kudos
2 Replies
JenniferNery
Esri Regular Contributor
I have not seen this particular exception but I think this might be a related thread: http://forums.arcgis.com/threads/34564-Change-map-based-on-runtime-with-Silverlight-API. When replacing base layer, since it defines the Map.Extent and SpatialReference, you can unset them before before replacing with new layer.
0 Kudos
NicoleSchmidt
Emerging Contributor
I was going to get on here and post again and mention that I do get the Bing map to show up every time now (you are right, it was related to now properly clearing the extent and Spatial Reference).  I still occasionally get that exception in debug when I have exceptions set to be thrown even when handled, but the bing map shows up so I have what I need.

Thank you!
0 Kudos