Error CS1061: 'HttpWebRequest'

来源:互联网 发布:java并发是什么意思 编辑:程序博客网 时间:2024/06/18 07:25

2017.07.23

错误信息:

Program.cs(26,66): error CS1061: 'HttpWebRequest'does not contain a definition for 'GetResponse' and no extension method'GetResponse' accepting a first argument of type 'HttpWebRequest' could befound

(are you missing a using directive or anassembly reference?)


解决方法:

因为版本更新问题,错误原因是:没有request.GetResponse()方法;修改成request.GetResponseAsync().Result;即可。或者修改同步异步访问设置,优化性能。


原创粉丝点击