加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

如何使用WebAPI没有ASP.NET MVC?

发布时间:2020-12-15 23:19:39 所属栏目:asp.Net 来源:网络整理
导读:我想使用WebAPI作为我的现有项目(经典ASP.NET),但据我所知,只能使用WebAPI与MVC. 使用ASP.NET可以使用WebAPI吗? 解决方法 从 linked page: Although ASP.NET Web API is packaged with ASP.NET MVC,it is easy to add Web API to a traditional ASP.NET We
我想使用WebAPI作为我的现有项目(经典ASP.NET),但据我所知,只能使用WebAPI与MVC.

使用ASP.NET可以使用WebAPI吗?

解决方法

从 linked page:

Although ASP.NET Web API is packaged with ASP.NET MVC,it is easy to
add Web API to a traditional ASP.NET Web Forms application. This
tutorial walks you through the steps.

To use Web API in a Web Forms application,there are two main steps:

Add a Web API controller that derives from the ApiController class.
Add a route table to the Application_Start method. Create a Web Forms
Project

Start Visual Studio 2010 and select New Project from the Start page.
Or,from the File menu,select New and then Project.

In the Templates pane,select Installed Templates and expand the Visual C# node. Under Visual C#,select Web. In the list of project templates,select ASP.NET Web Application. Enter a name for the project and click OK.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读