0

我正在尝试在我的 .NET 项目中使用高级请求,但遇到异常

System.SystemException: 'AdvancedRequestSupporter 函数中的 ServiceCode 错误:advancedRequest 在 11: http.requestCall $L1 $L0 '</p>

InvalidCastException:无法将“System.Collections.Generic.Dictionary2[System.String,System.String]”类型的对象转换为“System.Collections.Generic.Dictionary2[System.String,System.Object]”类型。

代码:AdvancedRequestSpecification req = new AdvancedRequestSpecification("/pubapi/v1/properties/namespace"); req.SetMethod(“POST”); 字典正文 = new Dictionary(); 身体[“测试”] = 55;req.SetBodyStringifyJson(body) ;

    // Specify the headers            
    Dictionary<String, string> headers = new Dictionary<String, string>();
    headers["Content-Type"] = "application/json";
    req.SetHeaders(headers);

    AdvancedRequestResponse res = AdvancedRequest(req);

即使我没有设置正文或标题,我也会收到此异常

所以像 AdvancedRequestSpecification req = new AdvancedRequestSpecification("/pubapi/v1/properties/namespace"); req.SetMethod(“POST”); AdvancedRequestResponse res = AdvancedRequest(req);

谁能帮忙?我忘了提到我尝试过使用 Box 和 egynte

4

1 回答 1

0

我已经反编译了您的 dll 并发现了问题,AdvancedRequestSpecification 有一个 Dictionary(String, string) 标头属性,而您的 RequestCall.Execute() 将 headers 变量直接转换为 Dictionary(string,object) 这不起作用,我已将 AdvancedRequestSpecification 标头属性更改为 Dictionary 并且它现在正在工作,

所以我担心的是,从客户的角度来看,我根本看不到这段代码是如何经过测试的,这不会激发你对图书馆的信心

此外,你们通过这个论坛、支持票或 stackoverflow 都没有回复,这让我根本不想使用它。

于 2018-08-24T11:06:32.467 回答