且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在IIS上运行自托管(基于owin的)Web API?

更新时间:2023-02-15 23:03:23

为了理解理论-

In order to understand theory - take a look at this question. If you want your OWIN self-hosted WEB API application to be running on IIS, you need to use Owin.Host.SystemWeb package. You should:

  • 添加一个Startup.cs类(您的IIS托管应用程序的入口点)
  • 向OWIN管道介绍您的入口点:用标记启动类owin属性或通过web.config进行操作.(请参阅本文供参考)

P.S.您总是可以在Visual Studio中查看标准的脚手架空Web API项目.它包括现成的IIS Web主机

P.S. You can always take a look at a standard scaffolded empty Web API project in Visual Studio. It includes IIS web host out-of-the-box