Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Method not allowed error
Message
De
20/03/2017 15:23:18
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
C# 5.0
OS:
Windows 10
Database:
MS SQL Server
Divers
Thread ID:
01649202
Message ID:
01649206
Vues:
59
This message has been marked as the solution to the initial question of the thread.
Your code doesn't show any HttpGet attribute. But if the attribute is present then the method name should be irrelevant (assuming WebApi and attribute routing)

>UPDATE. My colleague helped to solve this problem. For unknown reason the methods need to have Get in front of the method name. Although I also added explicit attribute HTTPGet just in case.
>
>
>Hi everybody,
>
>I'm getting the following error and I could not figure out what may be wrong. Here is the error in the console:
>
>http://localhost:9753/SiriuswareControl/api/maxKeysOnServer/forceRefreshAll 405 (Method Not Allowed)
>
>Here is the code - the top one works fine, the bottom produces that error - I don't see the difference and don't understand the error:
>
>
>[Route("GetMaxKeysOnServer")]
>        public IHttpActionResult GetMaxKeysOnServer()
>        {
>            var maxKeysOnServer = _maxKeyTablesAdapter.GetMaxkeysOnServer();
>
>            return Ok(maxKeysOnServer);
>        }
>
>        [Route("forceRefreshAll")]
>        public IHttpActionResult ForceRefreshAll()
>        {
>            int nextKey = _maxKeyTablesAdapter.SetNextLastModValue("RefreshALL");
>
>            return Ok(nextKey);
>        }
>
>Also, this code is not being even hit, so the error happens before that.
>
>Thanks a lot in advance.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform