首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >JSON-RPC异常

JSON-RPC异常
EN

Stack Overflow用户
提问于 2012-03-30 06:50:20
回答 1查看 778关注 0票数 0

我在windows phone应用程序中使用json-rpc.net中的json-rpc客户端。代码:

代码语言:javascript
复制
 var client = new AustinHarris.JsonRpc.JsonRpcClient(new Uri("http://www.raboof.com/projects/jayrock/demo.ashx"));
var myObs = client.Invoke<string>("echo", "hello world", Scheduler.ThreadPool);
myObs.Subscribe(
    onNext: _ =>
    {
        Console.WriteLine(_.Result);
    });
        }

然后我想要获取数据,使用JsonReaderException退出应用程序:

代码语言:javascript
复制
Newtonsoft.Json.JsonReaderException
  Message=Unexpected character encountered while parsing value: <. Line 0, position 0.
  LineNumber=0
  LinePosition=0
  Path=""
  StackTrace:
       at Newtonsoft.Json.JsonTextReader.ParseValue()
       at Newtonsoft.Json.JsonTextReader.ReadInternal()
       at Newtonsoft.Json.JsonTextReader.Read()
       at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ReadForType(JsonReader reader, JsonContract contract, Boolean hasConverter, Boolean inArray)
       at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType)
       at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
       at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
       at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
       at Newtonsoft.Json.JsonConvert.DeserializeObject(String value)
       at AustinHarris.JsonRpc.JsonRpcClient.<>c__DisplayClassa`1.<>c__DisplayClassc.<>c__DisplayClasse.<Invoke>b__9(IAsyncResult riar)
       at System.Net.Browser.ClientHttpWebRequest.<>c__DisplayClassa.<InvokeGetResponseCallback>b__8(Object state2)
       at System.Threading.ThreadPool.WorkItem.WaitCallback_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadPool.WorkItem.doWork(Object o)
       at System.Threading.Timer.ring()
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-04-04 16:43:07

如果json-rpc客户端解析器代码在接收响应时中断,并且它在第一个字符(Line 0, position 0)处终止,而这个字符恰好是一个<字符,那么您就不得不怀疑服务返回了XML。

您确定您正在与正确的服务端点对话吗?使用正确的协议?

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/9934692

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档