Advertisement
Guest User

Untitled

a guest
Jan 24th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.69 KB | None | 0 0
  1. public class Startup
  2.  
  3. {
  4.  
  5. public void Configuration(IAppBuilder app)
  6.  
  7. {
  8.  
  9. app.Use<LoggingMiddleware>();
  10.  
  11. }
  12.  
  13. }
  14.  
  15. public class LoggingMiddleware
  16.  
  17. {
  18.  
  19. private AppFunc appFunc;
  20.  
  21. public LoggingMiddleware(System.Func<System.Collections.Generic.IDictionary<string, object>, System.Threading.Tasks.Task> func)
  22.  
  23. {
  24.  
  25. this.appFunc = func;
  26.  
  27. }
  28.  
  29. public async Task Invoke(IDictionary<string,object> env)
  30.  
  31. {
  32.  
  33. Console.WriteLine(“Request method is+ env[“owin.RequestMethod]);
  34.  
  35. var task = appFunc.Invoke(env);
  36.  
  37. }
  38.  
  39. }
  40.  
  41. class Program
  42.  
  43. {
  44.  
  45. static void Main()
  46.  
  47. {
  48.  
  49. Microsoft.Owin.Hosting.WebApp.Start<Startup>(“http://localhost:12345&#8221;);
  50.  
  51. Console.ReadLine();
  52.  
  53. }
  54.  
  55. }
  56.  
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement