예제 #1
0
파일: Program.cs 프로젝트: mehuledu/ndc
 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));
 }
 public FileUploadBufferPolicySelector(OwinBufferPolicySelector owinBufferPolicySelector)
 {
     _owinBufferPolicySelector = owinBufferPolicySelector;
 }