因此,我使用Grapevine.RESTClient来管理REST接口的客户端。我使用它在LocalSystem中运行的服务和用户在同一台机器上运行的进程之间进行通信。
我的问题是,当服务没有运行时,我的客户端会得到一个异常,其中包含一条'Error: Value不能为null‘的消息。
我试图在客户端上创建一些逻辑,以便理解并接受服务有时不可用的情况,就像服务自动更新时一样。
或者也许我应该接受这个例外的信息有点奇怪?
RESTClient client;
client = new RESTClient(baseUrl);
RESTRequest request = new RESTRequest(resource);
request.Method = Grapevine.HttpMethod.GET;
request.ContentType = Grapevine.ContentType.JSON;
request.Timeout = 30000;
RESTResponse response = client.Execute(request);以上抛出的System.ArgumentNullException具有e.Message =“值不能为空。\r\n参数名称:cookie”。
嗯..。查看github上的Grapevine代码,即使响应对象是在this.Cookies调用的catch块中从e.response中创建的,代码似乎也试图向GetResponse添加cookie集合。它可能有也可能没有cookie集合。应该对this.Cookies.Add(response.Cookies)周围的空块进行测试,对吗?
https://github.com/scottoffen/Grapevine/blob/master/Grapevine/Client/RESTClient.cs
无法像葡萄树的开发人员建议的那样创建葡萄标记。没有足够的分数
发布于 2016-01-26 13:18:31
我也遇到过同样的问题。不幸的是,错误信息具有误导性。对我来说,修复方法是向文件App.config添加一个默认代理。
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.net>
<defaultProxy useDefaultCredentials="true" />
</system.net>
</configuration>https://stackoverflow.com/questions/32045770
复制相似问题