小编Kel*_*ang的帖子

即使可以从 chrome 访问 XDocument 加载失败

var doc = XDocument.Load("https://www.predictit.org/api/marketdata/all");
Run Code Online (Sandbox Code Playgroud)

失败,但异常:

System.dll 中发生类型为“System.Net.WebException”的未处理异常

附加信息:基础连接已关闭:发送时发生意外错误。

即使您可以通过 chrome访问https://www.predictit.org/api/marketdata/all

api 页面:https : //predictit.freshdesk.com/support/solutions/articles/12000001878-does-predictit-make-market-data-available-via-an-api- 提到将文本附加到请求头,可能是线索?

“要更改上述任何一项的返回类型,请将以下内容之一添加到请求标头中。

接受:应用程序/xml

接受:应用程序/json”

我检查了我的防火墙,两个网络都允许使用 Visual Studio。

c# xml

2
推荐指数
1
解决办法
780
查看次数

标签 统计

c# ×1

xml ×1