public static void TestConfiguration(IAppBuilder app) { BasicWebApiLogPolicy.Initialize(); Log.Write(() => Messages.Application_Started); // Execution order is important here BasicWebApiLogPolicy.Log = message => { Trace.WriteLine(message); System.Console.WriteLine(message); }; app .UseContainerInitializer(TestInitializeContainer) .UseJwtAuthentication() .UseGzipDeflateCompression() .UseWebApiWithHttpConfigurationInitializers( ( config, service) => { config.Formatters.Remove(config.Formatters.JsonFormatter); config.Formatters.Add(ObcJsonMediaTypeFormatter); }); }
public static void Configuration(IAppBuilder app) { var obcJsonMediaTypeFormatter = new ObcJsonMediaTypeFormatter( typeof(AttemptOnUnregisteredTypeJsonSerializationConfiguration < CompactFormatJsonSerializationConfiguration <NullJsonSerializationConfiguration> >).ToJsonSerializationConfigurationType()); BasicWebApiLogPolicy.Initialize(); Log.Write(() => Messages.Application_Started); // Execution order is important here BasicWebApiLogPolicy.Log = message => { Trace.WriteLine(message); System.Console.WriteLine(message); }; app .UseWebApiWithHttpConfigurationInitializers( ( config, service) => { config.Formatters.Remove(config.Formatters.JsonFormatter); config.Formatters.Insert(0, obcJsonMediaTypeFormatter); }) .UseContainerInitializer(LiveInitializeContainer) .UseCors() .UseJwtAuthentication() .UseGzipDeflateCompression(); }