サービスのアドレスを指定するために Google の位置情報を呼び出そうとすると、次のメッセージが表示されます。
ターゲット マシンがアクティブに拒否したため、接続できませんでした 173.194.66.95:80
C# で ASP.net 4 を使用しています。
これは私のコードです:
protected void btn_FindAddress_Click(object sender, EventArgs e)
{
url = "http://maps.googleapis.com/maps/api/geocode/xml?latlng=";
query = LatY.Text + "," + LongX.Text + "&sensor=true";
Address.Text = url;
Uri uri = new Uri (url + query);
// Create a request for the URL.
WebRequest request = WebRequest.Create(uri);
//// If required by the server, set the credentials.
request.Credentials = CredentialCache.DefaultCredentials;
// Get the response.
WebResponse response = request.GetResponse();
// Display the status.
Status.Text = (((HttpWebResponse)response).StatusDescription);
// Get the stream containing content returned by the server.
Stream dataStream = response.GetResponseStream();
// Open the stream using a StreamReader for easy access.
StreamReader reader = new StreamReader(dataStream);
// Read the content.
string responseFromServer = reader.ReadToEnd();
// Display the content.
Address.Text = responseFromServer;
// Clean up the streams and the response.
reader.Close();
response.Close();
}