c# - WebAPI HTTPDelete method not found via request but found in Swagger -
i have api controller
method:
[route("campaigns")] [httpdelete] public async task<ihttpactionresult> delete(string brandid,string campaignid) { try { var merchantid = currentuserinfo.getmerchantid(); await _service.deleteasync(merchantid, brandid, campaignid); return statuscode(httpstatuscode.nocontent); } catch (exception e) { log(e); return badrequest(e.message); } }
and angularjs
app
sending request:
$http.delete(config.resourcenames.campaign, { params: { brandid: brandid, campaignid: campaignid } }) .then(function (response) { return response; }, function (error) { return error; });
config file:
var resourcenames = { campaign: '/api/campaigns' };
so routing valid. request return 404 not found
.
i checked via swagger
, delete
method visible @ list when try use it. return not found
.
why happing?
edit:
while using "iss express" there error 404 when switch "local iss" error change 405 method not allowed.
may need write:
[route("api/campaigns")]
Comments
Post a Comment