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

我想使用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.

相关文章

### 创建一个gRPC服务项目(grpc服务端)和一个 webapi项目(...
一、SiganlR 使用的协议类型 1.websocket即时通讯协议 2.Ser...
.Net 6 WebApi 项目 在Linux系统上 打包成Docker镜像,发布为...
一、 PD简介PowerDesigner 是一个集所有现代建模技术于一身的...
一、存储过程 存储过程就像数据库中运行的方法(函数) 优点:...
一、Ueditor的下载 1、百度编辑器下载地址:http://ueditor....