4

I posted this yesterday ...

https://stackoverflow.com/questions/32615769/owin-webapi-odata-v4-aspnet-identity-initialisation

If I change the first line of the startup configuration method to ...

var config = GlobalConfiguration.Configuration ?? new HttpConfiguration(); 

Then I get this error where navigating to the root ...

The 'DelegatingHandler' list is invalid because the property 'InnerHandler' of 'CorsMessageHandler' is not null. Parameter name: handlers

I found some information dotted about that suggested that the base implementation of "HttpServer" had a bug in it related to batching and that microsoft had said they implemented some new batching framework so wern't going to fix it, the blogs offered up this code sample to fix the bug ...

public class BatchServer : HttpServer { private readonly HttpConfiguration _config; public BatchServer(HttpConfiguration configuration) : base(configuration) { _config = configuration; } protected override void Initialize() { var firstInPipeline = _config.MessageHandlers.FirstOrDefault(); if (firstInPipeline != null && firstInPipeline.InnerHandler != null) { InnerHandler = firstInPipeline; } else { base.Initialize(); } } } 

Apparently this doesn't seem to be solving my problem.

So, i'm stuck between these two errors with no idea how to get out.

1 Answer 1

6

I just ran into the same error on a similar configuration. Basically, you're on the right path, but having read this great answer, I realized I had to use a different overload of the .UseWebApi() that accepted the HttpServer.

So, the Startup.cs should look something like this:

HttpConfiguration config = GlobalConfiguration.Configuration ?? new HttpConfiguration(); config.EnableCors(); //the next two lines I had to change - instead of 'config' pass in the HttpServer appBuilder.UseWebApi(GlobalConfiguration.DefaultServer); appBuilder.UseNinjectWebApi(GlobalConfiguration.DefaultServer); 
Sign up to request clarification or add additional context in comments.

1 Comment

Hmm i completely forgot about this question ... I actually solved it using similar code in the end ... good catch :)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.