I am using Signalr 2, Webapi 2 and Ninject for Ioc and I am having problems.
In SignalR 2.0, you cannot replace JsonSerializer. As said here:
SignalR 2.0.0 beta2 Extension IJsonSerializer
I need to ignore ReferenceLoopHandling in json, so I used this code:
var serializerSettings = new JsonSerializerSettings
{
ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
NullValueHandling = NullValueHandling.Ignore
};
GlobalHost.DependencyResolver.Register(typeof(JsonSerializer), () => JsonSerializer.Create(serializerSettings));
Everything works fine, but I also call signalR clients from Webapi, and the call will not work unless I install this code at the beginning of the application:
GlobalHost.DependencyResolver = new NinjectSignalRDependencyResolver(NinjectIocConfig.Kernel);
Calling caller clients from webapi now works, but JSON serialization options are no longer used.
How can I get around this or what am I doing wrong?
Thank you in advance