Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Feb 11, 2013 07:54 AM by kalekylssen
Feb 09, 2013 01:15 PM|LINK
I am receiving an exception when attempting to connect to a hub from a console application. The error thrown is "Unexpected character encountered while parsing value: <.". It is thrown when I call
Initially I had it all working in a test project and could send messages from the console to the clients. I then tried to port it to an existing MVC 3 web app and that is when the error started to occur.
Both the test web application and the existing application are hosted in IIS and have the same set up. If I try to connect to the test application everything still works ok, switching just the hub url to another port (for the exisitng app) and the connect
I have ran fiddler and it would seem that the test web app is using server sent events and the exisitng project (one that doesn't work) is using long polling.
Does anyone have any idea what could be causing the connect to fail.
Feb 09, 2013 06:48 PM|LINK
That message normally suggest that the url you're connecting to is incorrect or it could be that there was some sorta of error that occured when starting the connection. The reason you see "Unexpected character encountered while parsing value: <."
is because we expect a JSON response and HTML is being returned instead.
To see the error, you can do this:
using (var error = ex.GetError())
Or you can use fiddler with Streaming mode on (click the Stream button) and look at the response from negotiate and view the html error page.
Feb 11, 2013 07:54 AM|LINK
Thanks for the reply.
I got to the bottom of it this morning, I had to change my url in the console to my machine name from localhost so that I could see the negotiate response in Fiddler. Turns out I was getting an error from our internal SingleSignOn solution, adding a auth
cookie to the collection fixed the problem and the connection worked fine.
Thanks for the help.