2014-01-29 87 views
0

我在API控制器,這條路叫Recruitingasp.net網頁API 2屬性路徑沒有找到

ResponseType(typeof (int))] 
[Route("Recruiting/setprimary/")] 
public async Task<IHttpActionResult> PutUpdatePrimary(string userId, string orgId) 
{ 
    return Ok(); 
} 

我試圖通過AJAX來打這個路由像這樣:

self.updatePrimary = function() { 
    var orgKey = self.selectedOrgKey(); 
    alert(orgKey); 
    $.ajax({ 
     type: "PUT", 
     contentType: "application/json; charset=utf-8", 
     url: "/Recruiting/setprimary/" + "?userId=" + userId + "&?orgId=" + orgKey, 
     data: null, 
     dataType: "json", 
     success: function (data) { 
      bootbox.alert('Changes saved successfully.'); 
     }, 
     error: function (err) { 
      bootbox.alert('An error occured while trying to set primary organisation. Please try again :/'); 
     } 
    }); 
    return true; 
}; 

提琴手說它找不到路線。我在這裏有什麼錯誤?

+0

當你觀看網絡流量在你的開發工具是什麼完整的URI,當您試圖打的行動? –

回答

5

看起來你有一個錯字在您要求的網址:與其"&?orgId=" ..它應該是"&orgId="