I've been through just about every article I can find, on SO and more. I've made changes to the Web.config
to meet the answers as they all seem to point to removing the WebDAV
module and handler.
However, I'm still getting the error:
405 Method Not Allowed
The requested resource does not support http method 'PUT'.
NOTE: this was originally just an MVC 4 project. I've added artifacts to support Web API. Seems like it's possible I may have missed something.
NOTE: the GET
calls are working just fine from Angular.
Web API Route Config
configuration.Routes.MapHttpRoute(
name: "Default API",
routeTemplate: "api/{controller}/{id}",
defaults: new { action = "Get", id = RouteParameter.Optional },
constraints: new { id = @"[\da-z-]{36}" });
configuration.Routes.MapHttpRoute(
name: "Default API with Action",
routeTemplate: "api/{controller}/{action}",
defaults: new { action = "Get" });
var formatter = GlobalConfiguration.Configuration.Formatters.JsonFormatter;
formatter.SerializerSettings.ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver();
Web.config
<modules runAllManagedModulesForAllRequests="true">
<remove name="WebDAVModule" />
</modules>
<handlers accessPolicy="Read, Execute, Script">
<remove name="WebDAV" />
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
PUT
API Entry
public async Task<IHttpActionResult> Put([FromBody] EditUserViewModel viewModel)
Client Side
vm.model.$update(function () {
$state.go(userStates.app);
});
Is it possible it's falling into the second route configuration? If so, how can I verify what route configuration .NET is trying to use?