我的代碼的這部分引發異常。我該如何解決這個問題?XML文檔System.Net.WebException
XmlDocument locrequest = new XmlDocument();
locrequest.Load(String.Format("http://api.geoips.com/ip/{0}/key/.myapikey./output/xml/", player.IP));
XmlNode root = locrequest.DocumentElement;
string from = root.SelectSingleNode("country_name").InnerText.ToLower();
System.Net.WebException: Error: ConnectFailure (Not enough buffer space is available)
完整的錯誤http://pastebin.com/8u6MpeWS
編輯: 如果我添加 locrequest.XmlResolver = null;
它拋出另一個異常:
System.NullReferenceException: Object reference not set to an instance of an object
這有什麼錯呢?
你確定player.IP包含一個有效的IP地址嗎? –