简体   繁体   中英

mvc4 application doesn't load controller from backbone collection url on iis 8.5 after publishing

This is the first time I have ever tried to publish web application; I'm using IIS 8.5. The application is a Backbone application that retrieves and saved data on SQL Server 2008. I had some issues displaying images and some other files, but I managed to solve it. However, the main collection of the backbone is not loading. I get GET http://localhost/Edit/GetQuestions 404 (Not Found) where Edit is the controller. The application works when I run from VSTO 2013 without any issue, but it can't find the MVC4 controller once deployed. Here's my collection

App.Collections.Questions = Backbone.Collection.extend({
    model: App.Models.Question,
    url: '../Edit/GetQuestions',    

});

I added '..' in the url to test if that works since I had to do that to load images from CSS URL. With or without '..' didn't load the controller.

Here's my route config:

 routes.MapRoute(
                "Questions",
                "{Controller}/{action}",
                new { Controller = "Edit", action = "GetQuestions", id = UrlParameter.Optional }                   

            );

Can somebody please explain what's going on and how can I fix this? Since this is my first application, I'm still learning and trying to understand how things work. I googled but couldn't find anything that relates to this issue I'm experiencing.

Please let me know if you need me to add anything else to the question. I'm not sure what's useful and what's not.

Try this:

//model url
url: 'Edit/GetQuestions' 

 //Router config.
 routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        routes.MapRoute(
            name: "Default",
            url: "{controller}/{action}/{id}",
            defaults: new { controller = "Edit", action = "GetQuestions", id = UrlParameter.Optional }
        );

refer to change web application authentication to use Windows Authentication . Turned out, there was no issue with the controller or the url, it was the authentication to the SQL server that wasn't established which couldn't retrieve the data.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM