예제 #1
0
        public static Func <IDictionary <string, object>, Task> CreateWebApiAppFunc2(HttpConfiguration config, HttpMessageHandlerOptions options = null)
        {
            var bufferPolicy = new OwinBufferPolicySelector();

            config.Services.Replace(typeof(IHostBufferPolicySelector), bufferPolicy); // Done just so App can get access to it.
            var app = new HttpServer(config);

            if (options == null)
            {
                options = new HttpMessageHandlerOptions()
                {
                    MessageHandler       = app,
                    BufferPolicySelector = bufferPolicy,
                    ExceptionLogger      = new GlobalErrorLoggingService(),
                    ExceptionHandler     = new GlobalErrorHandlerService()
                };
            }
            var handler = new HttpMessageHandlerAdapter(new NotFoundMiddleware(), options);

            return((env) => handler.Invoke(new OwinContext(env)));
        }
예제 #2
0
 public FileUploadBufferPolicySelector(OwinBufferPolicySelector owinBufferPolicySelector)
 {
     _owinBufferPolicySelector = owinBufferPolicySelector;
 }