[英]Getting error on Route attribute in Api method
I have created Api controller and trying to add 1 api method but getting error when adding Route attribute on my api method: 我创建了Api控制器并尝试添加1种api方法,但是在我的api方法上添加Route属性时出现错误:
This is my method: 这是我的方法:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web.Http;
public class MyController : ApiController
{
[AllowAnonymous]
[HttpPost]
[Route("api/abc/Get")] //Getting error :type or namespace Route could not be found
public async Task<object> Get()
{
}
}
But on Route Attribute i am getting error: 但是关于路线属性我得到错误:
Error :Type or namespace Route could not be found 错误 :找不到类型或名称空间路由
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.