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

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

unity3d - Fatal error- Monodevelop-Unity failed to start -