asp.net-web-api

DELETE/PUT verbs result in 404 Not Found in WebAPI, only when running locally

六眼飞鱼酱① 提交于 2021-01-26 07:38:16
问题 I know this is a commonly addressed issue, and I've done everything that many posts here on SO suggest. When I try to delete a record using WebAPI (version 2) from my MVC5 front end running under local IIS, I get a 404 Not Found response. Here are the things I've tried: I've added the following under <system.webServer /> in my WebAPI web.config: <system.webServer> <validation validateIntegratedModeConfiguration="false" /> <modules runAllManagedModulesForAllRequests="true"> <remove name=

REST - Query string vs. URL path

倾然丶 夕夏残阳落幕 提交于 2021-01-25 07:30:47
问题 I am working on a Web Api application and I am currently struggling with my understanding of RESTful API Design. Let's say there is a Post resource /api/posts and I want the clients give the opportunity to request all Posts for the current month. From my understanding there are 2 ways to achieve this. One way could be to make the current month as a resource. The other way could be a query string for the Post resource. What is the best (RESTful) way to do this? api/posts/currentmonth or api

JWT authentication issue with web api plugin in nopCommerce 4.30

会有一股神秘感。 提交于 2021-01-24 15:57:52
问题 I implement JWT authentication for authorization using access token or bearer token in web api plugin with nopCommerce version 4.30. It is working fine with default source of nopCommerce 4.30. But when i used my API plugin with any Seven spikes plugins (SevenSpikes.Nop.Plugins.AjaxCart, SevenSpikes.Nop.Plugins.QuickView, etc), its not working and threw exception like "System.ArgumentException: 'Duplicate Controller with DuplicateControllerName:NopAjaxCartShoppingCart is already added'". Here

JWT authentication issue with web api plugin in nopCommerce 4.30

心不动则不痛 提交于 2021-01-24 15:52:33
问题 I implement JWT authentication for authorization using access token or bearer token in web api plugin with nopCommerce version 4.30. It is working fine with default source of nopCommerce 4.30. But when i used my API plugin with any Seven spikes plugins (SevenSpikes.Nop.Plugins.AjaxCart, SevenSpikes.Nop.Plugins.QuickView, etc), its not working and threw exception like "System.ArgumentException: 'Duplicate Controller with DuplicateControllerName:NopAjaxCartShoppingCart is already added'". Here

JWT authentication issue with web api plugin in nopCommerce 4.30

空扰寡人 提交于 2021-01-24 15:52:14
问题 I implement JWT authentication for authorization using access token or bearer token in web api plugin with nopCommerce version 4.30. It is working fine with default source of nopCommerce 4.30. But when i used my API plugin with any Seven spikes plugins (SevenSpikes.Nop.Plugins.AjaxCart, SevenSpikes.Nop.Plugins.QuickView, etc), its not working and threw exception like "System.ArgumentException: 'Duplicate Controller with DuplicateControllerName:NopAjaxCartShoppingCart is already added'". Here

JWT authentication issue with web api plugin in nopCommerce 4.30

六眼飞鱼酱① 提交于 2021-01-24 15:48:33
问题 I implement JWT authentication for authorization using access token or bearer token in web api plugin with nopCommerce version 4.30. It is working fine with default source of nopCommerce 4.30. But when i used my API plugin with any Seven spikes plugins (SevenSpikes.Nop.Plugins.AjaxCart, SevenSpikes.Nop.Plugins.QuickView, etc), its not working and threw exception like "System.ArgumentException: 'Duplicate Controller with DuplicateControllerName:NopAjaxCartShoppingCart is already added'". Here

Can't decide between Task<IActionResult>, IActionResult and ActionResult<Thing>

孤街醉人 提交于 2021-01-21 06:58:09
问题 While I do understand the concept of Task , ActionResult , etc. I still feel unsure which would be most intuitive to type in a controller if nothing else is specified. Taking consideration to be as explicit with a type returned, I should go like this: [HttpGet] public ActionResult<Thing> Get() { return Ok(Context.Things); } However, going for a generic type of API paradigm I should use this: [HttpGet] public IActionResult Get() { return Ok(Context.Things); } Finally, respecting the

Call A Multi-Part Form Method Programmatically

南笙酒味 提交于 2021-01-20 11:32:34
问题 I have the following method in my WebApi [HttpPost] [Route("foo/bar")] [Consumes("multipart/form-data")] [DisableRequestSizeLimit] public async Task<IActionResult> FooBar([FromForm] Data data) The Data class looks like this public class Data { public string A { get; set; } public string[] B { get; set; } public string[] C { get; set; } public IFormFile File { get; set; } } I am struggling to work out how I can pass the values in the Data class into this method via C# code. I need to pass the

Call A Multi-Part Form Method Programmatically

◇◆丶佛笑我妖孽 提交于 2021-01-20 11:31:39
问题 I have the following method in my WebApi [HttpPost] [Route("foo/bar")] [Consumes("multipart/form-data")] [DisableRequestSizeLimit] public async Task<IActionResult> FooBar([FromForm] Data data) The Data class looks like this public class Data { public string A { get; set; } public string[] B { get; set; } public string[] C { get; set; } public IFormFile File { get; set; } } I am struggling to work out how I can pass the values in the Data class into this method via C# code. I need to pass the

Call A Multi-Part Form Method Programmatically

大兔子大兔子 提交于 2021-01-20 11:30:20
问题 I have the following method in my WebApi [HttpPost] [Route("foo/bar")] [Consumes("multipart/form-data")] [DisableRequestSizeLimit] public async Task<IActionResult> FooBar([FromForm] Data data) The Data class looks like this public class Data { public string A { get; set; } public string[] B { get; set; } public string[] C { get; set; } public IFormFile File { get; set; } } I am struggling to work out how I can pass the values in the Data class into this method via C# code. I need to pass the