MVC-Web API: 405 method not allowed

前端 未结 4 613
悲&欢浪女
悲&欢浪女 2020-11-29 08:51

So, I am stuck in a strange behavior, that is, I am able to send(or POST) data using Postman (plugin of chrome) or using RESTClient(extension of Firefox)<

4条回答
  •  萌比男神i
    2020-11-29 09:27

    No need webconfig, all you need is to add:

      services.AddCors(o => o.AddPolicy("MyPolicy", builder =>
                {
                    builder.AllowAnyOrigin()
                           .AllowAnyMethod()
                           .AllowAnyHeader();
                }));
    

提交回复
热议问题