2

I am stuck trying to find the reason this happens. I have a WebAPI service in my module. A specific call to a public entry point (the default path) works fine on my dev machine (Win7, IIS 7.5) but doesn't on the production server (Win2012, IIS8). The DNN installations are clones. Here is the call:

/DesktopModules/DNNEurope/LocalizationEditor/API?tabid=1&moduleid=4

The Win2012 installation replies with "Unable to locate a controller for ..." and then naming the path and namespace this controller is in. Note the routing should work just fine as it works fine in dev.

There is one quirk to note, here. I'm supplying the tabid and moduleid through the querystring, rather than through headers as is the practice when you're doing json exchanges. That is because this call is supposed to be consumed elsewhere. Again, keep in mind this works fine locally.

The route definition is:

mapRouteManager.MapHttpRoute("DNNEurope/LocalizationEditor", "Default", "", New With {.Controller = "Localization", .Action = "ListObjects"}, New String() {"DNNEurope.Modules.LocalizationEditor.Services"})

and the method:

<HttpGet()>
<AllowAnonymous()>
Public Function ListObjects() As HttpResponseMessage

Any ideas?

Peter Donker
  • 328
  • 2
  • 15
  • Web API scans the assemblies looking for controllers. It could be possible that an assembly loading might have caused failure due to failure in loading its dependencies. In these kind of failures Web API does not throw an error and silently ignores it. You can take a look at this answer related to a similar issue: http://stackoverflow.com/a/16674992/1184056 ...It might be working on localhost as all the dependencies might be available there...Also what is the version of Web API that you are using? 4.0 or 5.0?... – Kiran Jan 29 '14 at 15:41

1 Answers1

0

Kiran's remark put me on the right track. In the project there was a reference to the Mvc library that was not on the server. Strangely enough for the asp.net application this is not a problem but for WebAPI this is. Even though any of the methods in the Mvc library were no longer used as I switched to WebAPI at one point during the project. So locally this Mvc library was still found, but not in production.

Peter Donker
  • 328
  • 2
  • 15