c#webClient(503)服务器不可用
问题描述:
using (var wc = new WebClient())
{
Uri urls = new Uri(url);
wc.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
dokuman.Load(wc.OpenRead(urls), Encoding.UTF8);
}
dokuman.Load错误远程服务器返回错误:(503)服务器不可用。
答
错误不言自明。这是一个服务器错误,您无法从客户端代码中做任何事情。检查您的网址是否正确。将网址粘贴到浏览器窗口中,看看是否收到同样的错误。
The error is self-explanatory. It's a server error and you can do nothing much about it from the client code. Check if your url is correct. Paste the url in a browser window and see if you get the same error.