Although this exception is thrown in my Windows service code:
HttpStreamer.exe Error: 0 : SignalR exception thrown by Task: System.AggregateException: One or more errors occurred. ---> Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: T. Path '', line 0, position 0. at Newtonsoft.Json.JsonTextReader.ParseValue()
at Newtonsoft.Json.JsonTextReader.ReadInternal() at Newtonsoft.Json.JsonTextReader.Read() at Newtonsoft.Json.Linq.JObject.Load(JsonReader reader) at Newtonsoft.Json.Linq.JObject.Parse(String json) at Microsoft.AspNet.SignalR.Hubs.HubRequestParser.Parse(String
data) at Microsoft.AspNet.SignalR.Hubs.HubDispatcher.OnReceived(IRequest request, String connectionId, String data) at Microsoft.AspNet.SignalR.PersistentConnection.<>c__DisplayClassa.<>c__DisplayClassc.<ProcessRequest>b__7() at Microsoft.AspNet.SignalR.TaskAsyncHelper.<>c__DisplayClass3c.<FromMethod>b__3b()
at Microsoft.AspNet.SignalR.TaskAsyncHelper.FromMethod[TResult](Func`1 func) --- End of inner exception stack trace --- ---> (Inner Exception #0) Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: T. Path '', line
0, position 0. at Newtonsoft.Json.JsonTextReader.ParseValue() at Newtonsoft.Json.JsonTextReader.ReadInternal() at Newtonsoft.Json.JsonTextReader.Read() at Newtonsoft.Json.Linq.JObject.Load(JsonReader reader) at Newtonsoft.Json.Linq.JObject.Parse(String
json) at Microsoft.AspNet.SignalR.Hubs.HubRequestParser.Parse(String data) at Microsoft.AspNet.SignalR.Hubs.HubDispatcher.OnReceived(IRequest request, String connectionId, String data) at Microsoft.AspNet.SignalR.PersistentConnection.<>c__DisplayClassa.<>c__DisplayClassc.<ProcessRequest>b__7()
at Microsoft.AspNet.SignalR.TaskAsyncHelper.<>c__DisplayClass3c.<FromMethod>b__3b() at Microsoft.AspNet.SignalR.TaskAsyncHelper.FromMethod[TResult](Func`1 func)<---
After going through the HTTP traffic exchanged between my SignalR client and server, I did not find any badly formed JSON messages, so it implies to me the problem is either in the client code:
function startConnection() {
alert('Called startConnection()...');
//connection.start().done(function () {
// $("#broadcast").click(function () {
// alert('Starting connection...');
// connection.send($('#msg').val());
// });
//});
messageHub.on('Send', function (message) {
SuccessHandler(message);
// Turn logging on so we can see the calls in the browser console
connection.logging = true;
// Start the connection
connection.start().done(function () {
alert("Now connected!");
}).fail(function () {
alert("Could not Connect!");
});
});
function SuccessHandler(jObject) {
// Do Work with the object
}
Or because I'm using IE9 which doesn't support web sockets, I'm running into a CORS issue. Will test the CORS hypothesis now to see what happens.
derricklau
Member
22 Points
29 Posts
Re: SignalR Hosted in Windows Service
Feb 01, 2013 01:46 PM|LINK
Thanks for reading the post!
I got Fiddler and all that, plus I got the SignalR source code, so I'll start debugging it on my own.
Sorry...was just being lazy...won't do so anymore.
derricklau
Member
22 Points
29 Posts
Re: SignalR Hosted in Windows Service
Feb 02, 2013 03:49 PM|LINK
Although this exception is thrown in my Windows service code:
HttpStreamer.exe Error: 0 : SignalR exception thrown by Task: System.AggregateException: One or more errors occurred. ---> Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: T. Path '', line 0, position 0. at Newtonsoft.Json.JsonTextReader.ParseValue() at Newtonsoft.Json.JsonTextReader.ReadInternal() at Newtonsoft.Json.JsonTextReader.Read() at Newtonsoft.Json.Linq.JObject.Load(JsonReader reader) at Newtonsoft.Json.Linq.JObject.Parse(String json) at Microsoft.AspNet.SignalR.Hubs.HubRequestParser.Parse(String data) at Microsoft.AspNet.SignalR.Hubs.HubDispatcher.OnReceived(IRequest request, String connectionId, String data) at Microsoft.AspNet.SignalR.PersistentConnection.<>c__DisplayClassa.<>c__DisplayClassc.<ProcessRequest>b__7() at Microsoft.AspNet.SignalR.TaskAsyncHelper.<>c__DisplayClass3c.<FromMethod>b__3b() at Microsoft.AspNet.SignalR.TaskAsyncHelper.FromMethod[TResult](Func`1 func) --- End of inner exception stack trace --- ---> (Inner Exception #0) Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: T. Path '', line 0, position 0. at Newtonsoft.Json.JsonTextReader.ParseValue() at Newtonsoft.Json.JsonTextReader.ReadInternal() at Newtonsoft.Json.JsonTextReader.Read() at Newtonsoft.Json.Linq.JObject.Load(JsonReader reader) at Newtonsoft.Json.Linq.JObject.Parse(String json) at Microsoft.AspNet.SignalR.Hubs.HubRequestParser.Parse(String data) at Microsoft.AspNet.SignalR.Hubs.HubDispatcher.OnReceived(IRequest request, String connectionId, String data) at Microsoft.AspNet.SignalR.PersistentConnection.<>c__DisplayClassa.<>c__DisplayClassc.<ProcessRequest>b__7() at Microsoft.AspNet.SignalR.TaskAsyncHelper.<>c__DisplayClass3c.<FromMethod>b__3b() at Microsoft.AspNet.SignalR.TaskAsyncHelper.FromMethod[TResult](Func`1 func)<---
ProcessId=15836 ThreadId=4 DateTime=2013-02-02T16:35:58.4737250Z
After going through the HTTP traffic exchanged between my SignalR client and server, I did not find any badly formed JSON messages, so it implies to me the problem is either in the client code:
function startConnection() { alert('Called startConnection()...'); //connection.start().done(function () { // $("#broadcast").click(function () { // alert('Starting connection...'); // connection.send($('#msg').val()); // }); //}); messageHub.on('Send', function (message) { SuccessHandler(message); // Turn logging on so we can see the calls in the browser console connection.logging = true; // Start the connection connection.start().done(function () { alert("Now connected!"); }).fail(function () { alert("Could not Connect!"); }); }); function SuccessHandler(jObject) { // Do Work with the object }Or because I'm using IE9 which doesn't support web sockets, I'm running into a CORS issue. Will test the CORS hypothesis now to see what happens.
derricklau
Member
22 Points
29 Posts
Re: SignalR Hosted in Windows Service
Feb 04, 2013 02:19 PM|LINK
My apologies. I misunderstood what SignalR was designed for:
https://github.com/SignalR/SignalR/issues/129
Was trying to use the Hub inside the Windows Service, which is not supported.
Sorry and closing this out as not supported.
Thanks to everyone who replied to me!