C# 从地理代码中找到超过\u查询\u限制状态

C# 从地理代码中找到超过\u查询\u限制状态,c#,asp.net,google-maps,console-application,geocoding,C#,Asp.net,Google Maps,Console Application,Geocoding,我必须从地理编码更新数据库,以获取存储在数据库中的地址的经度和纬度。 为此,我创建了一个控制台应用程序。每天,我可以从谷歌每个用户更新25000条记录,从过去的4到5天起,我每天从不同的3台机器上执行我的控制台 但从今天起,我将超过限制状态,无法更新数据库。 我该怎么办? 下面是我获取控制台经纬度的代码: protected static void FindLocation(string strLocation, out string lat, out string lng, out strin


我必须从地理编码更新数据库,以获取存储在数据库中的地址的经度和纬度。
为此,我创建了一个控制台应用程序。每天,我可以从谷歌每个用户更新25000条记录,从过去的4到5天起,我每天从不同的3台机器上执行我的控制台
但从今天起,我将超过限制状态,无法更新数据库。
我该怎么办?
下面是我获取控制台经纬度的代码:

protected static void FindLocation(string strLocation, out string lat, out string lng, out string Output)
{
    StreamWriter myWriter;
    System.Net.HttpWebRequest geoRequest;
    string googResponse;
    googResponse = "";
    lat = "";
    lng = "";
    Output = "";
    string abc = "";
    string strRequestURL;
    strRequestURL = "https://maps.googleapis.com/maps/api/geocode/xml?address=" + strLocation + "&sensor=false";
    try
    {
        geoRequest = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(strRequestURL);
        geoRequest.Method = "POST";
        geoRequest.KeepAlive = true;

        UTF8Encoding encoding = new UTF8Encoding();
        byte[] bytes = encoding.GetBytes(strRequestURL);
        geoRequest.ContentLength = bytes.Length;
        using (Stream writeStream = geoRequest.GetRequestStream())
        {
            writeStream.Write(bytes, 0, bytes.Length);
            writeStream.Close();
        }

        System.Net.HttpWebResponse geoResponse;

        geoResponse = (System.Net.HttpWebResponse)geoRequest.GetResponse();

        if (geoResponse != null)
        {

            XPathDocument document = new XPathDocument(geoResponse.GetResponseStream());
            XPathNavigator navigator = document.CreateNavigator();

            // get response status
            XPathNodeIterator statusIterator = navigator.Select("/GeocodeResponse/status");
            while (statusIterator.MoveNext())
            {
                if (statusIterator.Current.Value != "OK")
                {
                    if (statusIterator.Current.Value == "OVER_QUERY_LIMIT")
                    {

                    }
                    Output = "Failed";

                }
                else
                {
                    Output = statusIterator.Current.Value;
                }
            }

            // get results
            XPathNodeIterator resultIterator = navigator.Select("/GeocodeResponse/result");
            while (resultIterator.MoveNext())
            {

                XPathNodeIterator geometryIterator = resultIterator.Current.Select("geometry");
                while (geometryIterator.MoveNext())
                {

                    XPathNodeIterator locationIterator = geometryIterator.Current.Select("location");
                    while (locationIterator.MoveNext())
                    {

                        XPathNodeIterator latIterator = locationIterator.Current.Select("lat");
                        while (latIterator.MoveNext())
                        {
                            lat = latIterator.Current.Value;
                        }

                        XPathNodeIterator lngIterator = locationIterator.Current.Select("lng");
                        while (lngIterator.MoveNext())
                        {
                            lng = lngIterator.Current.Value;
                        }
                    }
                }
            }
        }
        else
        {
            Output = "Failed";
        }
    }
    catch (Exception ex)
    {
        Output = "Failed";
    }

}

您是否为每个用户使用不同的api密钥?这可能看起来很傻,但是你的程序今天已经完成了25000个请求了吗?谢谢你的快速回复。我敢肯定,这是今天的第一次。如果有帮助,请检查此项:)