When I make a AJAX request, the strange thing is that when I run it locally it works perfectly but when I upload it to IIS it throws me the following error.
HTTP Error 404.0 - Not Found
Details:
Module: IIS Web Core
Notification: MapRequestHandler
Controller: StaticFile
Error code: 0x80070002
Route: http://15.15.1.159:80
Physical path: C: \ Users \ admwebsrvs \ Documents \ webservices \ Home \ GetUsers
Login method: Anonymous
User login: Anonymous
RouteConfig.cs :
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional}
);
}
HomeController.cs :
[HttpGet]
public String GetUsers()
{
List<User> lista = new List<User>();
var usersArray = GetUserFromFile(WITH_ID);
if (usersArray == null)
return "No se ha podido recuperar la información del servidor";
return usersArray.ToString();
}
Petition AJAX :
function loadTable(){
vm.dtOptions = DTOptionsBuilder.fromFnPromise(function () {
var defer = $q.defer();
onLoader();
$http.get('../Home/GetUsers').then(callbackUsers);
function callbackUsers(result) {
defer.resolve(result.data);
$scope.users = result.data;
offLoader();
}
return defer.promise;
}).withBootstrap()
.withPaginationType('full_numbers')
.withOption('createdRow', createdRow);
vm.dtColumns = [
DTColumnBuilder.newColumn('firstname').withTitle('Nombre'),
DTColumnBuilder.newColumn('lastname').withTitle('Apellido'),
DTColumnBuilder.newColumn('email').withTitle('Correo'),
DTColumnBuilder.newColumn('username').withTitle('Usuario de Red'),
DTColumnBuilder.newColumn('id').withTitle('Id').notVisible(),
DTColumnBuilder.newColumn('id').withTitle('Actions').notSortable()
.renderWith(actionsHtml)
];
}