Pregunta

When I use the JsonSerializer option of

_connection.JsonSerializer.TypeNameHandling = TypeNameHandling.All

I get an error on _connection.Start() {"StatusCode: 500, ReasonPhrase: 'Internal Server Error', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:\r\n{\r\n Date: Tue, 04 Mar 2014 12:26:26 GMT\r\n Server: Microsoft-HTTPAPI/2.0\r\n Content-Length: 0\r\n}"}

when I use this option every thing works fine _connection.JsonSerializer.TypeNameHandling = TypeNameHandling.Auto

¿Fue útil?

Solución

You'll want to enable detailed errors for server which are off by default. I enable them in debug mode only

[assembly: OwinStartup(typeof(Startup))]
namespace MvcProject.App_Start
{
    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            var hubConfiguration = new HubConfiguration();

#if DEBUG
            hubConfiguration.EnableDetailedErrors = true;
#endif
            app.MapSignalR(hubConfiguration);

Then the error should be pretty self explanatory after that.

Also check that you have a version of JSON.net that fixes this bug: JsonSerializer does not appear to respect TypeNameHandling property correctly

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top