1

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>

tereško
  • 56,151
  • 24
  • 92
  • 147
Jose
  • 1,070
  • 2
  • 13
  • 25
  • 1
    http://stackoverflow.com/q/12807331/#comment23576850_13620659, perhaps? Or, can you share the `` config? Also, which HTTP Verb is `Upload()` associated with? Does your API route include an `{action}` placeholder? And, does the plugin send requests to [`/api/controller/upload` or just `/api/controller`](http://stackoverflow.com/a/10917370)? Are the requests [cross-origin](http://stackoverflow.com/a/10980767) (ref: [same-origin](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Same_origin_policy_for_JavaScript))? – Jonathan Lonowski Jul 15 '13 at 18:26
  • I will post my config in an edit. Upload is associated with HttpGet and HttpPost (yes, both) and the request goes to api/upload (/api/controller in the RouteConfig file) – Jose Jul 15 '13 at 18:30
  • I instantiate a repository in public UploadController(), but that never fires (and thus it's commented out, I have set breakpoints when it was working)...I used to think it was a problem, something overwritten in my settings file, but you seem to think the problem lies with my WebAPI controller? It's weird since this works in my collegue's computers, except for mine. – Jose Jul 15 '13 at 18:33
  • Sorry, I'm not trying to say that's the problem. I'm just info fishing. Your question doesn't have a lot of technical details. – Jonathan Lonowski Jul 15 '13 at 18:34
  • I do apologize about that...I know it's very vague but it's because I really don't know where to start. You are being of great help btw :) Thanks for taking the time, I posted the config section – Jose Jul 15 '13 at 18:35
  • For some reason adding them doesn't do anything. I really appreciate your help man :) I will keep looking and trying of course! – Jose Jul 15 '13 at 18:49

1 Answers1

0

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!

Jose
  • 1,070
  • 2
  • 13
  • 25