The main problem: GET is working, POST is not. I am new to WebAPI, so I'm probably doing something stupid, but I was joking a lot on the net trying to figure out why this is not working.
Pretty simple WebAPI C # application. I tried to bring this to very simple routes:
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
config.Routes.MapHttpRoute(
name: "ActionApi",
routeTemplate: "api/{controller}/{action}"
);
Controller Class:
public class CsvController : ApiController
{
public IEnumerable<string> Get()
{
return new string[] { "value1", "value2" };
}
public string Get(string csvName)
{
return "value";
}
[HttpPost]
[ActionName("LoadToSQL")]
public HttpResponseMessage LoadToSQL(
string storageAccount,
string accessKey,
string containerName,
string csvFileName,
string connectionString,
string targetDatabaseName,
string targetTableName)
{
try
{
CloudStorageAccount blobStorage = CloudStorageAccount.Parse(storageAccount);
Run it locally and plug in Fiddler. Try GET; work:

Try POST - crash:

My initial implementation only had
public HttpResponseMessage Post(
but it didn’t work, so I started trying to add certain routes and verb decorations.
It just does not see the POST action against this controller no matter what I do.
Any thoughts?
UPDATE - for each answer below, the correct way to do this work:
config.Routes.MapHttpRoute(
name: "ActionApi",
routeTemplate: "api/{controller}/{action}/{storageAccount}/{accessKey}/{containerName}/{csvFileName}/{connectionString}/{targetDatabaseName}/{targetTableName}"
);
All POST request parameters are displayed here.