|
楼主 |
发表于 2019-11-29 12:58:09
|
显示全部楼层
不是这个问题,目前已经解决,把源码HttphelperBase的request.header遍历添加改了,原来的request.KeepAlive属性没生效,新增的属性Connection:keep-alive又会报参数配置异常,不加又会返回上面的错,经测试改成下面就好了
private void SetHeaderValue(WebHeaderCollection header, string name, string value)
{
var property = typeof(WebHeaderCollection).GetProperty("InnerCollection",
System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
if (property != null)
{
var collection = property.GetValue(header, null) as NameValueCollection;
collection[name] = value;
}
}
又必须加两个header属性 item.Header.Add("Connection", "keep-alive"); item.Header.Add("Accept-Encoding", "gzip, deflate"); |
|