상세 컨텐츠

본문 제목

Microsoft Owin Source

카테고리 없음

by annaniadislihi 2020. 11. 26. 13:10

본문



The Print Shop has come a long way from the days when heavily pixelated banners printed out on perforated computer paper. Broderbund's The Print Shop Essentials is a next-generation production. The Print Shop 5, the newest version of America’s favorite desktop publishing software, is the most intuitive and user-friendly version to date! With a host of new features including a new and improved tool set and more images and templates than ever before, The Print Shop 5. https://naeerliafrat.tistory.com/1.

-->
  1. Microsoft.owin.security.facebook Source Code
  2. Microsoft.aspnet.webapi.owin Source Code
  3. Microsoft.owin.security Source

By Steve Smith and Rick Anderson

ASP.NET Core supports the Open Web Interface for .NET (OWIN). OWIN allows web apps to be decoupled from web servers. It defines a standard way for middleware to be used in a pipeline to handle requests and associated responses. ASP.NET Core applications and middleware can interoperate with OWIN-based applications, servers, and middleware.

Is contained within a class library, make sure that the executable consuming the library also includes the reference to Microsoft.Owin.Host.HttpListener.dll, or else it would not get deployed with your program, as there are no explicit references to it from the class library. These products are developed by the ASP.NET team at Microsoft in collaboration with a community of open source developers. See the list of Packages for information about individual components. Documentation is available in the Wiki and overview of OWIN and Katana.

OWIN provides a decoupling layer that allows two frameworks with disparate object models to be used together. The Microsoft.AspNetCore.Owin package provides two adapter implementations:

  • ASP.NET Core to OWIN
  • OWIN to ASP.NET Core

This allows ASP.NET Core to be hosted on top of an OWIN compatible server/host or for other OWIN compatible components to be run on top of ASP.NET Core.

Microsoft

Note

Using these adapters comes with a performance cost. Apps using only ASP.NET Core components shouldn't use the Microsoft.AspNetCore.Owin package or adapters.

This command work when I manually type in cmd. The code worked. Java execute external program. Or dir for testing it worked too.However I was trying to input a command ( business sentitive, I cannot postup). I also try to type: cd.

View or download sample code (how to download)

Running OWIN middleware in the ASP.NET Core pipeline

ASP.NET Core's OWIN support is deployed as part of the Microsoft.AspNetCore.Owin package. You can import OWIN support into your project by installing this package.

OWIN middleware conforms to the OWIN specification, which requires a Func<IDictionary<string, object>, Task> interface, and specific keys be set (such as owin.ResponseBody). The following simple OWIN middleware displays 'Hello World':

The sample signature returns a Task and accepts an IDictionary<string, object> as required by OWIN.

The following code shows how to add the OwinHello middleware (shown above) to the ASP.NET Core pipeline with the UseOwin extension method.

You can configure other actions to take place within the OWIN pipeline. Xap app store.

Note

Response headers should only be modified prior to the first write to the response stream.

Note

Multiple calls to UseOwin is discouraged for performance reasons. OWIN components will operate best if grouped together.

Using ASP.NET Core Hosting on an OWIN-based server

OWIN-based servers can host ASP.NET Core apps. One such server is Nowin, a .NET OWIN web server. In the sample for this article, I've included a project that references Nowin and uses it to create an IServer capable of self-hosting ASP.NET Core.

IServer is an interface that requires a Features property and a Start method.

Start is responsible for configuring and starting the server, which in this case is done through a series of fluent API calls that set addresses parsed from the IServerAddressesFeature. Note that the fluent configuration of the _builder variable specifies that requests will be handled by the appFunc defined earlier in the method. This Func is called on each request to process incoming requests.

We'll also add an IWebHostBuilder extension to make it easy to add and configure the Nowin server.

With this in place, invoke the extension in Program.cs to run an ASP.NET Core app using this custom server:

Microsoft.owin.security.facebook Source Code

Learn more about ASP.NET Core Servers.

Run ASP.NET Core on an OWIN-based server and use its WebSockets support

Another example of how OWIN-based servers' features can be leveraged by ASP.NET Core is access to features like WebSockets. The .NET OWIN web server used in the previous example has support for Web Sockets built in, which can be leveraged by an ASP.NET Core application. The example below shows a simple web app that supports Web Sockets and echoes back everything sent to the server through WebSockets.

This sample is configured using the same NowinServer as the previous one - the only difference is in how the application is configured in its Configure method. A test using a simple websocket client demonstrates the application:

OWIN environment

You can construct an OWIN environment using the HttpContext.

OWIN keys

Microsoft owin source free

OWIN depends on an IDictionary<string,object> object to communicate information throughout an HTTP Request/Response exchange. ASP.NET Core implements the keys listed below. See the primary specification, extensions, and OWIN Key Guidelines and Common Keys.

Request data (OWIN v1.0.0)

KeyValue (type)Description
owin.RequestSchemeString
owin.RequestMethodString
owin.RequestPathBaseString
owin.RequestPathString
owin.RequestQueryStringString
owin.RequestProtocolString
owin.RequestHeadersIDictionary<string,string[]>
owin.RequestBodyStream

Request data (OWIN v1.1.0)

KeyValue (type)Description
owin.RequestIdStringOptional

Response data (OWIN v1.0.0)

KeyValue (type)Description
owin.ResponseStatusCodeintOptional
owin.ResponseReasonPhraseStringOptional
owin.ResponseHeadersIDictionary<string,string[]>
owin.ResponseBodyStream
Microsoft

Other data (OWIN v1.0.0)

KeyValue (type)Description
owin.CallCancelledCancellationToken
owin.VersionString

Common keys

KeyValue (type)Description
ssl.ClientCertificateX509Certificate
ssl.LoadClientCertAsyncFunc<Task>
server.RemoteIpAddressString
server.RemotePortString
server.LocalIpAddressString
server.LocalPortString
server.IsLocalbool
server.OnSendingHeadersAction<Action<object>,object>

SendFiles v0.3.0

KeyValue (type)Description
sendfile.SendAsyncSee delegate signaturePer Request

Microsoft.aspnet.webapi.owin Source Code

Opaque v0.3.0

KeyValue (type)Description
opaque.VersionString
opaque.UpgradeOpaqueUpgradeSee delegate signature
opaque.StreamStream
opaque.CallCancelledCancellationToken

WebSocket v0.3.0

KeyValue (type)Description
websocket.VersionString
websocket.AcceptWebSocketAcceptSee delegate signature
websocket.AcceptAltNon-spec
websocket.SubProtocolStringSee RFC6455 Section 4.2.2 Step 5.5
websocket.SendAsyncWebSocketSendAsyncSee delegate signature
websocket.ReceiveAsyncWebSocketReceiveAsyncSee delegate signature
websocket.CloseAsyncWebSocketCloseAsyncSee delegate signature
websocket.CallCancelledCancellationToken
websocket.ClientCloseStatusintOptional
websocket.ClientCloseDescriptionStringOptional

Microsoft.owin.security Source

Additional resources