简体   繁体   中英

IIS 8.0 Detailed Error - 405.0 - Method Not Allowed

I am just looking for the different causes that might cause this error. I was working on an intranet site and nothing up to that point had gone wrong. I was working on using Blueimp's Fileupload plugin and I was able to upload files to my server no problem. I am using a WebAPI controller in my MVC 4 application to handle the upload of the file

 public HttpResponseMessage Upload()

All of a sudden, in one of my test runs, I got this error and haven't been able to get rid of it. I have tried removing WebADV (not even installed in my machine) etc...I am running out of options here and I cannot trace back this error.

Any help whatsoever will be appreciated, even if it's pointing to another post. I apologize for the vagueness of the post, but I cannot seem to be able to trace my error and thus, I'm a little desperate.

Once again, thanks!

Config:

<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
  <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>

I solved the issue in the following manner. I downloaded Ninject.WebApi.DependencyResolver. This allowed me to register WebApi with my controller factory. After that, changing the path (eg "api/upload" (api/controllername)) to "api/upload/upload" fixed the issue!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM