Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Method not allowed error
Message
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Method not allowed error
Versions des environnements
Environment:
C# 5.0
OS:
Windows 10
Database:
MS SQL Server
Divers
Thread ID:
01649202
Message ID:
01649202
Vues:
45
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.
If it's not broken, fix it until it is.


My Blog
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform