Quantcast
Channel: ASP.NET 4.5 Hosting News (SuperBlogAds Network) » cheap asp.net 4.5 hosting
Viewing all articles
Browse latest Browse all 29

ASP.NET Free Trial Hosting Tips :: 405 Method Not Allowed using ASP.NET Web API

$
0
0
ASP.NET is a development framework for building web pages and web sites with HTML, CSS, JavaScript and server scripting.
I have been using the ASP.NET Web API recently on a project and this has been working well together with Backbone.js as the front end framework. I have been using PUT for updating the model and POST for adding to the model.
Everything is going well until I deployed the application on a production server. I got the error when trying to perform a PUT request to the server from the front-end. The error was “405 Method not allowed”.
The reason for this is two parts; one the production server has WebDav installed and this has caused conflicts with ASP.NET Web API and two by default the handler was not allowing the PUT verb.
The solution was to remove the WebDav handler and WebDav module from web.config and change the ExtensionlessUrl handler verb attribute.
<system.webServer>
<validation validateIntegratedModeConfiguration=”false” />
<modules runAllManagedModulesForAllRequests=”true”>
<remove name=”WebDAVModule” />
</modules>
<handlers>
<remove name=”WebDAV” />
<remove name=”ExtensionlessUrlHandler-Integrated-4.0″ />
<add name=”ExtensionlessUrlHandler-Integrated-4.0″ path=”*.” verb=”GET,HEAD,POST,DEBUG,PUT” type=”System.Web.Handlers.TransferRequestHandler” resourceType=”Unspecified” requireAccess=”Script” preCondition=”integratedMode,runtimeVersionv4.0″ />
</handlers>
</system.webServer>
Thanks for reading the article.

Viewing all articles
Browse latest Browse all 29

Trending Articles