1
votes

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.

1

1 Answers

1
votes

I'm supposing that if you are using custom domains in the Azure Website:

  1. You have created a DNN portal alias for the site corresponding with the custom DNS name
  2. You have also enabled that domain host name in the Azure Website
  3. If you are using a naked comain (like "http://mydomain.com/...") ensure that you have the correct setup (check http://maartenvanstam.wordpress.com/2013/08/23/configuring-a-naked-domain-name-for-a-windows-azure-web-site/)

If this doesn't help, just check the module example "DNN Todo List" available at GitHub at http://github.com/davidjrh/dnntodolist. Is just using the same pattern.