如题。跨域已设置在控制器基类。 同样的而命名空间。为了减少阅读量,方法体里面的内容删掉了,里面内容不会报错,就是简单的接收参数返回参数。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using DBLayer;
using DBLayer.InterFace.Models;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
[Route("api/[controller]/[action]")]
[ApiController]
public abstract class b: MyControllerBaseController
{
[HttpPost]
public IActionResult a([FromBody] Guid id)
{}
}
这个一直404,用Postman测试,传入的方式和参数一样。
另外这个就成功:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using DBLayer;
using DBLayer.InterFace;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
[Route("api/[controller]/[action]")]
[ApiController]
public class HomeController : MyControllerBaseController
{
[HttpPost]
public JsonResult Test([FromBody] Guid obj)
{}
}
请问有人能帮解答吗?