Apply OWIN pipeline side by side Asp.net core

Viewed 118

Is there any way to Apply OWIN side by side of ASP.NET Core pipeline?

I have moved my old ASP.NET to Core and I have some middlewares written with OWIN and I was wondering if I could be able to move all of my logics to Core one without changing a single line of Code!

my plan is having old OWIN middleware besides my new ASP core middlewares

this is a way I had implemented my OWIN middlewares

public class MyMiddleware : OwinMiddleware
    {
        public MyMiddleware(OwinMiddleware next)
            : base(next)
        {
        }
        public async override Task Invoke(IOwinContext context)
        {

            await Next.Invoke(context);
        }
    }

Thanks in advance!

2 Answers

I have some middlewares written with OWIN and I was wondering if I could be able to move all of my logics to Core one without changing a single line of Code

ASP.NET Core supports plugging in of OWIN middleware, we can import OWIN support into project by installing the Microsoft.AspNetCore.Owin package, which might need a bit of modification based on your existing OWIN middlewares.

For more information, please refer to "Running OWIN middleware in the ASP.NET Core pipeline".

Since it was my problem, consequently I managed to find a solution and also I've written a blog post briefly explains how it is doable, regardless of the topic I just need to mention this applying OWIN beside ASP.NET Core is nonsense unless there is a valid reason for that, and my reason was updating an old ASP.NET MVC application to Core one, First of all, I have added OWIN pipeline there, afterward got rid of Http handlers/modules and rewritten with middleware instead and at the later point, I've managed to update to Core which was fascinating to be doing some impossible job ;)

https://alikhalili.me/blog/posts/owin-asp-net-core/

Related