Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Method not allowed error
Message
 
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
Method not allowed error
Environment versions
Environment:
C# 5.0
OS:
Windows 10
Database:
MS SQL Server
Miscellaneous
Thread ID:
01649202
Message ID:
01649202
Views:
44
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
Next
Reply
Map
View

Click here to load this message in the networking platform