稳定的FSharp.Data版本不支持.Net核心。我尝试过。
但是,以下代码例外
远程服务器返回错误:(302)暂时移动。
该站点从“ ... / Portal /”重定向“位置:/ Portal / Login”是正常的,并且可以在完整的.Net框架中使用。
let headers = [
UserAgent ConfigurationManager.AppSettings.["UserAgent"]
Accept "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"
KeepAlive "true"
]
let customized (req : HttpWebRequest) =
//req.Proxy <- WebProxy(ConfigurationManager.AppSettings.["Proxy"], true)
req.AllowAutoRedirect <- false // Manually handle redirect
ServicePointManager.SecurityProtocol <- SecurityProtocolType.Tls ||| SecurityProtocolType.Tls11
||| SecurityProtocolType.Tls12 //||| SecurityProtocolType.Ssl3
req
let cc = CookieContainer()
let url = "https://usbtrustgateway.usbank.com/"
let html = Http.RequestString(url, httpMethod = "GET", cookieContainer = cc,
headers = headers, customizeHttpRequest = customized)
在项目中包含文件时的异常。
顺便说一句,第三个断点从未被击中。