Your question has been submitted and is awaiting moderation.
Thank you for reporting this content, moderators have been notified of your submission.
we have a development site on a Azure VM and production on Azure Website both using DNN 7.1.2.
Ajax call to DnnApicontroller work fine on the Dev site, but fail on the Azure Website.
I've checked the Bin folder and ensured both are using the same dlls.
the error received is "{"Message":"Unable to locate a controller for http://localhost/DesktopModules/ContentModule/API/BusinessObjects/HelloWorld. Searched in namespaces: IPW.Modules.ContentModule, ContentModule."}"
this is an example of the ajax call:
$.ajax({
type: "POST",
cache: false,
url: baseServicePath + 'HelloWorld',
// data: { portalId: cur_portalId, storeId: '-1', roleId: '-1' },
dataType: "json",
beforeSend: serviceFramework.setModuleHeaders
}).done(function (data) {
console.log(data);
}).fail(function () {
console.log('Sorry failed to load hours');
});
The routemapper:
public void RegisterRoutes(IMapRoute mapRouteManager)
{
mapRouteManager.MapHttpRoute("ContentModule", "default", "{controller}/{action}", new[] { "My.Modules.ContentModule", "ContentModule" });
and the apicontroller:
[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;
}
}
The production is an Azure Website and suggestions are appreciated