We have a development site on an Azure VM and production on Azure Website both using DNN Platform 7.1.2.
The Ajax calls pattern as seen below calls the DnnApicontroller and works fine on the Dev site, but fails once deployed to the production site on the Azure Website.
I've checked the Bin folder to ensure both are using the same version dlls. I have checked the webconfig files and found those to be similar too.
The error received is "{"Message":"Unable to locate a controller for http://mydomain.com/DesktopModules/ContentModule/API/BusinessObjects/HelloWorld. Searched in namespaces: IPW.Modules.ContentModule, ContentModule."}"
These call work fine on the dev site. Based on the error message, the routing didn't discover a matching controller which the namespaces provided.
-this is an example of the ajax call:
$.ajax({
type: "POST",
cache: false,
url: baseServicePath + 'HelloWorld',
dataType: "json",
beforeSend: serviceFramework.setModuleHeaders
}).done(function (data) {
console.log(data);
}).fail(function () {
console.log('Sorry failed to load hours');
});
-the 'baseServicePath' obtains URL using the DNN Platform serviceFramework.getServiceRoot('ContentModule') + 'BusinessObjects/'
-The routemapper:
public void RegisterRoutes(IMapRoute mapRouteManager) {
mapRouteManager.MapHttpRoute("ContentModule", "default", "{controller}/{action}", new[] { "My.Modules.ContentModule", "ContentModule" });
}
-and the apicontroller method:
public class BusinessObjectsController : DotNetNuke.Web.Api.DnnApiController
{
[AllowAnonymous]
[AcceptVerbs("GET", "POST")]
public HttpResponseMessage HelloWorld()
{
string result = "Hello world! Time is: " + DateTime.Now + "";
var response = Request.CreateResponse(HttpStatusCode.OK, result, Configuration.Formatters.JsonFormatter);
return response;
}
}
}
Where the call fails is on the production site which is running on an Azure Website, the code is identical to the dev. The DNN Platform is using a custom mapping interface. Any suggestions are appreciated.