Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Method not allowed error
Message
From
20/03/2017 15:23:18
 
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
C# 5.0
OS:
Windows 10
Database:
MS SQL Server
Miscellaneous
Thread ID:
01649202
Message ID:
01649206
Views:
58
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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform