Created
April 14, 2014 20:56
-
-
Save darrelmiller/10682188 to your computer and use it in GitHub Desktop.
Create an AppFunc for a WebApi application
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static Func<IDictionary<string, object>, Task> CreateWebApiAppFunc(HttpConfiguration config) | |
{ | |
var app = new HttpServer(config); | |
var options = new HttpMessageHandlerOptions() | |
{ | |
MessageHandler = app, | |
BufferPolicySelector = new OwinBufferPolicySelector(), | |
ExceptionLogger = new WebApiExceptionLogger(), | |
ExceptionHandler = new WebApiExceptionHandler() | |
}; | |
var handler = new HttpMessageHandlerAdapter(null, options); | |
return (env) => handler.Invoke(new OwinContext(env)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment