【发布时间】:2014-12-23 00:23:00
【问题描述】:
我试图理解为什么只有在我打开提琴手时才能对提要进行简单调用。
我查看了以下链接,但似乎没有一个答案适用:
HttpWebRequest doesn't work except when fiddler is running
HttpWebRequest only works while fiddler is running
http://blogs.telerik.com/fiddler/posts/13-02-28/help!-running-fiddler-fixes-my-app-
我的代码很简单,据我所知,它应该只是用 xml 文件的内容填充变量:
using (var client = new WebClient())
{
text = client.DownloadString(path);
}
请注意,如果我正在运行 fiddler,这将完美运行,但如果我在 fiddler 未运行时运行它,则会失败并出现超时错误 (?)。
我可以直接从我的浏览器访问 xml 文件的路径 - 所以权限/访问似乎也不是问题。
http://www.tfl.gov.uk/tfl/syndication/feeds/cycle-hire/livecyclehireupdates.xml
Fiddler 的 RAW 输出为:
HTTP/1.1 200 OK
Via: 1.1 varnish, 1.1 ZTMG01
Connection: Keep-Alive
Proxy-Connection: Keep-Alive
Transfer-Encoding: chunked
Age: 19
Date: Mon, 22 Dec 2014 15:23:47 GMT
Content-Type: text/xml
ETag: "dce1c05f259961aeac88cebcdfdbeebe"
Server: AmazonS3
x-amz-id-2: C6oNmRATZO4E7eNiyPhyCOhqT45Mb9Wp0XXaU8KsBQf84gYeNzM9OPAOa9YBNFsL4DGsPSEs5Cw=
x-amz-request-id: 0CE21B93AC8DDC15
Last-Modified: Mon, 22 Dec 2014 15:22:31 GMT
X-TTL-RULE: 8
X-Cacheable: Yes. Cacheable
X-TTL: 60.000
X-Backend: proxy
X-Varnish: 10.76.2.236
X-Backend-Url: http://s3-eu-west-1.amazonaws.com/tfl.pub/Serco/livecyclehireupdates.xml
X-Hash-Url: /tfl.pub/Serco/livecyclehireupdates.xml
Access-Control-Allow-Origin: *
X-Varnish: 181999945 181994842
X-Banning:
X-Cache: HIT
X-Cache-Hits: 4
有人知道为什么会这样吗?
【问题讨论】:
-
这可能是代理问题吗? WebClient 可能会“意外”使用 Fiddler 的代理设置,从而阻止它运行。您可以发布成功调用的 Fiddler RAW 输出吗?
-
用 RAW 输出更新了我的问题。据我所见,没有什么不妥