Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
SQL
This code is run fine when i check this app on mobile but when i change location of mobile slightly then exception occur The exception occur that "The remote server is not found" but initially it work perfectly and reponse back and display value from server ,whenever the location is changed the exception occur thnx in advance

client side code::i-e windows phone 8


C#
void geolocator_PositionChanged(Geolocator sender, PositionChangedEventArgs args)
{

    try
    {
        Dispatcher.BeginInvoke(() =>
            {
                client= new ServiceReference2.GetPositionClient();

                // ddd.Text = "begin invoker";
                LatitudeTextBlock.Text = args.Position.Coordinate.Latitude.ToString("0.0000000000");
                LongitudeTextBlock.Text = args.Position.Coordinate.Longitude.ToString("0.000000000");
                // client.getPosCompleted += new EventHandler<ServiceReference2.getPosCompletedEventArgs>(sendData);
                client.getData1Completed += new EventHandler<ServiceReference2.getData1CompletedEventArgs>(sendData);

                //   client.getPosAsync(11, 11);
                client.getData1Async(11, 11);
            });
    }
    catch (Exception e2)
    {
        ddd.Text = "2" + e2.Message;
    }
}

public void sendData(object sender, ServiceReference2.getData1CompletedEventArgs e)
{
    try
    {
        dd.Text = "The Response Come from Server is ::  " + e.Result;
    }
    catch (Exception e3)
    {
        ddd.Text = "3"+e3.Message;
    }
}


server side code i-e WCF


C#
public class GetPosition : IGetPosition
{

    public string getData1(double lat, double lon)
    {
        return "updated sucessfully";
    }
}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900