IApplicationBuilder does not contain a definition for UseWebApi

烂漫一生 提交于 2019-12-10 20:09:39

问题


The VS 2015 Update 3 is out and I have started playing with it. But I hit a problem soon after. The IApplicationBuilder interface does not appear to have a definition for the UseWebApi extension method, but IAppBuilder does. In effect, I want to register my Web Api with the OWIN pipeline. Am I missing something?


回答1:


There is no need for the IApplicationBuilder interface to have a definition for the UseWebApi extension method. In IAppBuilder, it was used to register a Web Api with OWIN. But for IApplicationBuilder, because ASP.NET Core uses a unified model for both Web Api and MVC services, simply use the IApplicationBuilder.UseMvc method. It works!




回答2:


There is no UseWebApi in Asp.NET Core so I am not sure what the "relevant package" is. Here is a tutorial showing how to build Web API with Asp.NET Core.




回答3:


NuGet command:

Install-Package Microsoft.AspNet.WebApi.OwinSelfHost

Source



来源:https://stackoverflow.com/questions/38163548/iapplicationbuilder-does-not-contain-a-definition-for-usewebapi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!