Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Startup
- {
- public void Configuration(IAppBuilder app)
- {
- app.Use<LoggingMiddleware>();
- }
- }
- public class LoggingMiddleware
- {
- private AppFunc appFunc;
- public LoggingMiddleware(System.Func<System.Collections.Generic.IDictionary<string, object>, System.Threading.Tasks.Task> func)
- {
- this.appFunc = func;
- }
- public async Task Invoke(IDictionary<string,object> env)
- {
- Console.WriteLine(“Request method is “+ env[“owin.RequestMethod”]);
- var task = appFunc.Invoke(env);
- }
- }
- class Program
- {
- static void Main()
- {
- Microsoft.Owin.Hosting.WebApp.Start<Startup>(“http://localhost:12345”);
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement