Reference
The hosted ASP. NET Web API does not necessarily require IIS support, and we can use the self host as a host for any type of application (console, Windows Forms app, WPF app, or even Windows Service).
I. Summary
This issue also brings you to share is the real work of the stupid in real business scenarios, please follow a stupid perspective on how to implement the use of Microsoft ASP. NET Owin Technology hosting WEBAPI services, if you are interested in this issue of the tutorial content, then please allow a stupid with you to learn together!
Needless to say, directly on dry goods, we do not produce dry goods, we are just dry goods porter.
Iv. Demand Analysis
4.1. Previous Period Review
Last issue we shared the implementation of the client and service-side communication project based on the open source SuperSocket implementation of Web page submission printing data to the Web server side, the Web server will accept the print data through the socket communications servers to push to the specified client.
Can we simplify the call process steps above?
Directly allows the client to print the data to the local client without having to relay through the socket communication server.
4.2. Schematic diagram
4.3, Then the problem we are going to solve today can be summed up in the following sentence:
How do I get the Web page side to access the local desktop client directly in HTTP, just like a Web application on a remote IIS?
4.4, Implementing a self-host solution for Web applications
Implementing a simple HTTP service (. NET 2.0+) via HttpListener
Self-hosted selfhosting based on the WCF stack
Use ASP. NET Httpselfhost to host the Webapi service (. 4.0+)
Use ASP. Owin to host the Webapi service (. NET4.5 Microsoft recommended)
Wait a minute......
V. Knowledge points relating to coverage
ASP. WebAPI Httpselfhost/owin How to host the WebAPI service in the form of a desktop application;
ASP. WebAPI Httpselfhost/owin How to enable the server to support Cros cross-access;
IE10.0 the following browsers to achieve cors access through xdomainrequest;
Six, the source online interpretation and demonstration
Online video viewing
If you don't believe it, sweep it.
Implementation of Self-host Project based on ASP. WebAPI Owin