System.Net.WebException Время ожидания операции истекло - C#
Формулировка задачи:
Помогите заставить такой код работать.
Здесь я пытаюсь скачать заведомо большой xml-файл в переменную типа XElement, выдается ошибка system.Net.WebException Время ожидания операции истекло.
Никак не могу найти как установить таймаут больше.
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Xml;
using System.Xml.Linq;
using System.Net;
namespace test
{
class Program
{
static void Main(string[] args)
{
string xmlfileOrURL = @"http://archive.org/advancedsearch.php?q=xml&fl%5B%5D=avg_rating&fl%5B%5D=call_number&fl%5B%5D=collection&fl%5B%5D=contributor&fl%5B%5D=coverage&fl%5B%5D=creator&fl%5B%5D=date&fl%5B%5D=description&fl%5B%5D=downloads&fl%5B%5D=foldoutcount&fl%5B%5D=format&fl%5B%5D=headerImage&fl%5B%5D=identifier&fl%5B%5D=imagecount&fl%5B%5D=language&fl%5B%5D=licenseurl&fl%5B%5D=mediatype&fl%5B%5D=month&fl%5B%5D=num_reviews&fl%5B%5D=oai_updatedate&fl%5B%5D=publicdate&fl%5B%5D=publisher&fl%5B%5D=rights&fl%5B%5D=scanningcentre&fl%5B%5D=source&fl%5B%5D=subject&fl%5B%5D=title&fl%5B%5D=type&fl%5B%5D=volume&fl%5B%5D=week&fl%5B%5D=year&sort%5B%5D=&sort%5B%5D=&sort%5B%5D=&rows=5000000&page=1&callback=callback&output=xml&save=yes";
try
{
System.Xml.Linq.XElement xmlFile = System.Xml.Linq.XElement.Load(xmlfileOrURL);
}
catch (System.Exception ex)
{
xmlfileOrURL = xmlfileOrURL;
}
}
}
}Решение задачи: «System.Net.WebException Время ожидания операции истекло»
textual
Листинг программы
string url = "http://www.dreamincode.net/forums/xml.php?showuser=1253";
string xml;
using (var webClient = new WebClient())
{
xml = webClient.DownloadString(url);
}
XDocument doc = XDocument.Parse(xml);