Answered Unable to contact server?

  • Thursday, September 01, 2011 2:28 PM
     
      Has Code

    I've download the new Bing Maps WPF control, imported dll, use excatly the same code with the Documention, keep getting this error: "Unable to contact server. Please try again later"

    XAML:

     

    <Window x:Class="Weather.MainWindow"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:m="clr-namespace:Microsoft.Maps.MapControl.WPF;assembly=Microsoft.Maps.MapControl.WPF"
      Title="MainWindow" Height="1080" Width="1920" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" WindowState="Maximized" WindowStyle="None">
     <Grid>
      <m:Map Mode="AerialWithLabels" CredentialsProvider="CODE" x:Name="myMap" Center="37.806029,-122.407007" ZoomLevel="10"/>
     </Grid>
    </Window>

    I also disabled "Use Http1.1 option and UseHttp1.1 through a proxy connection within IE's advance options", it didn't work either.

     

    Any idea to fix this?

    Thanks in advance.


    ANC

All Replies

  • Friday, September 02, 2011 5:33 AM
     
     

    This message is displayed, when the map is not able to reach to config file for initialization of map resources.

    Try changing the proxy settings & make sure program can access internet.


    MSFT
    Hemant Goyal
  • Friday, September 02, 2011 5:43 AM
     
     

    It has access to internet. How can I change the proxy settings? From Project Properties?

    Thanks


    ANC
  • Friday, September 02, 2011 5:21 PM
     
     
  • Friday, September 02, 2011 7:24 PM
     
      Has Code

    I set the app.config like this:

    <?xml version="1.0"?>
    <configuration>
      <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
      </startup>
      <connectionStrings>
        <add name="DefaultConnection" connectionString="Data Source = |SQL/CE|" />
      </connectionStrings>
      <system.net>
        <defaultProxy useDefaultCredentials="true" />     
      </system.net>
    </configuration>
    

    I still get exactly the same error with the link you mentioned. Please check the image below for more details




    ANC
  • Wednesday, November 30, 2011 7:19 PM
     
     
    Hello Did you get the solution for the above error. Please reply
  • Thursday, December 01, 2011 3:13 AM
     
     
    I haven't got a solution for that yet but I figured out what causes the problem. Map control doesn't like to work behind a firewall. I do not get any error at home since there is no firewall but at work i keep getting the error. I tried opening all of the ports and ips for my IP number, nothing happened then I completely disabled firewall, it works fine now, so the solution is easy; disable the firewall :)
    ANC
    • Edited by ancogenli Thursday, December 01, 2011 3:14 AM
    •  
  • Tuesday, December 27, 2011 4:00 PM
     
     Answered

    I figured the problem. We need to set the proxy setting if it doesnt like the fire wall.

     System.Net.WebRequest.DefaultWebProxy = new WebProxy("<Proxy Address>", 80);

                System.Net.WebRequest.DefaultWebProxy.Credentials = new NetworkCredential(<UserID>,<PassWord>);

     

    If you set the default web proxy it Bing Maps will use it.

     

    Hope this helps everyone.

  • Tuesday, December 27, 2011 7:20 PM
     
     

    Sandeep,

    I doesn't work for me, I still have to disable the firewall.

    Thanks


    ANC
  • Wednesday, April 11, 2012 3:32 PM
     
     

    This doesn't work for me, either.  There doesn't appear to be any way to get the control to use the proxy.

  • Thursday, April 26, 2012 8:29 PM
     
     

    I'm new to WPF, but I added an app config file to my wpf project and there is a warning marker on that files' icon in the solution explorer. Plus I added the configuration settings recommended by Hement and still not able to get map to appear. I am behind a firewall and have no option to turn it off.

    Sandeep: where does your code go? Should I use it in addition to Hements configuration settings?