このバグレポートに基づく解決策を見つけました: https://github.com/SignalR/SignalR/issues/500
まず、カスタム IContractResolver を作成します
public class SignalRContractResolver : IContractResolver
{
private readonly Assembly _assembly;
private readonly IContractResolver _camelCaseContractResolver;
private readonly IContractResolver _defaultContractSerializer;
public SignalRContractResolver()
{
_defaultContractSerializer = new DefaultContractResolver();
_camelCaseContractResolver = new CamelCasePropertyNamesContractResolver();
_assembly = typeof(Connection).Assembly;
}
public JsonContract ResolveContract(Type type)
{
if (type.Assembly.Equals(_assembly))
return _defaultContractSerializer.ResolveContract(type);
return _camelCaseContractResolver.ResolveContract(type);
}
}
次にApplicationStartに登録します
var settings = new JsonSerializerSettings();
settings.Converters.Add(new StringEnumConverter());
settings.ContractResolver = new SignalRContractResolver();
var serializer = new JsonNetSerializer(settings);
GlobalHost.DependencyResolver.Register(typeof(IJsonSerializer), () => serializer);
私を正しい方向に向けてくれたhalter73に感謝します!