Implement Self-Host project practice based on ASP. NET WebAPI OWIN, webapiself-host
Reference
Host ASP. NET Web APIs do not necessarily require IIS support. We can use any type of applications (console, Windows Forms Application, WPF application, or even Windows Service) as the Host using Self Host.
I. Summary
This article also shares with you the real business scenarios encountered by Alibaba Cloud in actual work. Please follow the Alibaba Cloud's perspective on how to adopt Microsoft's ASP. net owin Technology carries the WebAPI service. If you are interested in the content of this tutorial, please allow Alibaba Cloud to learn with you!
We don't need to talk much about it. We just need to get the dry goods directly. We don't make the dry goods, but we are just the porters of the dry goods.
All the dry goods you want are here. 4. Demand Analysis
4.1,Last Review
In the previous issue, we shared the implementation of client-to-server communication projects based on open-source SuperSocket. In practice, the WEB page was submitted and printed to the WEB server, the WEB server pushes the received printed data to the specified client through the Socket communication server.
Can we simplify the above call procedure?
Directly let the Client Print the data to the local client, without the need to use the Socket communication server for transit.
4.2 schematic
Schematic diagram
4.3,The problems we want to solve today can be summarized as follows:
How does one allow the WEB Client to directly access the local Desktop client through HTTP, just like accessing Web applications on Remote IIS?
4.4,Implement the Self-Host solution for WEB Applications
Implement simple Http Services (. NET 2.0 +) through HttpListener)
Self-host SelfHosting Based on WCF Stack
Use ASP. NET HttpSelfHost to host WebAPI services (. NET 4.0 +)
Use ASP. net owin to host WebAPI services (. NET4.5 recommended by Microsoft)
And so on ......
5. Covered knowledge points
How does ASP. NET WebAPI HttpSelfHost/OWIN host the WebApi service as a desktop application;
How does ASP. NET WebAPI HttpSelfHost/OWIN enable the server to support cross-CROS access;
Explorer 10.0 and earlier browsers use XDomainRequest to implement CORS access;