阅读背景:

C#HttpClient.SendAsync在测试某些URL时抛出“发送请求时发生错误”异常

来源:互联网 

I am developing an C# console application for testing whether a URL is valid or works. It works well for most of URLs and can get response with HTTP Status Code from target website. But when testing some other URLs, the application throw an "An error occurred while sending the request" exception when running HttpClient.SendAsync method. So I can't get any response or HTTP Status Code even this URL actually works in the browser. I am desperate to find out how to handle this case. If the URL doesn't work or the server reject my request, it should at least give me corresponding HTTP Status code. I am developing an C# console application for t




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: