OWIN Details

1.OWIN.dll Introduction

Open Owin.dll with decompiling tool, you will find that there is only one IAppBuilder class library interfaces, so that OWIN is open Web Interface for .NET platform.

public interface IAppBuilder
{
IDictionary Properties
{
get;
}
IAppBuilder Use(object middleware, params object[] args);
object Build(Type returnType);
IAppBuilder New();
}

2.Microsoft.Owin.dll
Microsoft.Owin.dll is Microsoft's specific implementation of Owin, including "middleware." Hereinafter will be described using code based on a custom Owin of "middleware."

 

// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System.Threading.Tasks;

namespace Microsoft.Owin
{
/// <summary>
/// An abstract base class for a standard middleware pattern.
/// </summary>
public abstract class OwinMiddleware
{
/// <summary>
/// Instantiates the middleware with an optional pointer to the next component.
/// </summary>
/// <param name="next"></param>
protected OwinMiddleware(OwinMiddleware next)
{
Next = next;
}

/// <summary>
/// The optional next component.
/// </summary>
protected OwinMiddleware Next { get; set; }

/// <summary>
/// Process an individual request.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public abstract Task Invoke(IOwinContext context);
}
}

 

Next is the middleware used for further processing.
Custom middleware mainly rewrite Invoke to achieve their functional requirements.

Guess you like

Origin www.cnblogs.com/zkb9604/p/11529111.html