ich einen Web-API-Aufruf zu machen, und ich diesen Fehler:HttpGet Attribut für eine Methode Benötigtes, jedoch nicht andere
405 Method Not Allowed
The requested resource does not support http method 'GET'.
ist hier der Aufruf:
var config = {
url: rootWebApiUrl + '/api/containerMove/allowMultipleBoxesPerMove',
method: 'GET'
};
$http(config)
.then(function (response) {
// code here
}, function (response) {
// code here
});
Wenn ich fügen sie das HttpGet Attribut auf die Web-API-Methode, es funktioniert:
[HttpGet]
[Route("api/containerMove/allowMultipleBoxesPerMove")]
public bool AllowMultipleBoxesPerMove()
Was ich nicht verstehe, ist, dass HttpGet
nicht ne für andere Anrufe, die ich auf dem gleichen Web-API-Controller erstelle. Hier ist eine, die ohne das HttpGet
Attribut funktioniert:
var config = {
url: rootWebApiUrl + '/api/containerMove/getBatchRefreshInterval',
method: 'GET'
};
$http(config)
Und die Web-API-Methode:
[Route("api/containerMove/getBatchRefreshInterval")]
public int GetBatchRefreshInterval()
Warum brauche ich HttpGet
auf einer Web-API-Methode aber nicht die andere? Diese Aufrufe und API-Methoden sind fast identisch.