I have a .NET 4.5.2 Web Api that I am converting to .NET 4.8.
I went into each project in the solution, and changed the target framework to 4.8.
I updated the nuget packages in the projects
One controller has two methods that are very similar:
public class InsuredController : ApiController
{
[Route("thirdpartydata")]
[HttpPost]
public IHttpActionResult GetThirdPartyData([FromBody] ThirdPartyDataRequest request)
{
...
}
[Route("masterinsuredlist")]
[HttpPost]
public IHttpActionResult GetMasterInsuredList([FromBody] MasterInsuredListRequest request)
{
...
}
}
public class ThirdPartyDataRequest
{
public string User { get; set; }
public int AddressId { get; set; }
}
public class MasterInsuredListRequest
{
public string User { get; set; }
public int AddressId { get; set; }
}
When accessing the masterinsuredlist route, I get a result as expected.
However when accessing the thirdpartydata route, I get the error
HTTP/1.1 405 Method Not Allowed
I am using rest client to make the following call
POST http://localhost:123456/thirdpartydata HTTP/1.1
content-type: application/json
{
"User": "rhodder",
"AddressId" : 4163
}
Any ideas?