0

WindowsPhoneアプリケーションでjson-rpc.netのjson-rpcクライアントを使用しています。コード:

 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で終了します。

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()
4

1 に答える 1

1

応答を受信したときにjson-rpcクライアントパーサーコードが壊れ、文字である最初の文字(Line 0, position 0)で<停止した場合は、サービスがXMLを返したと疑う必要があります。

適切なサービスエンドポイントと話していることを確認しますか?適切なプロトコルで?

于 2012-04-04T08:43:06.627 に答える