简体   繁体   English

发布后,mvc4应用程序未从iis 8.5上的主干集合URL加载控制器

[英]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; 这是我第一次尝试发布Web应用程序。 I'm using IIS 8.5. 我正在使用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. 该应用程序是一个Backbone应用程序,可在SQL Server 2008上检索和保存数据。显示图像和其他文件时遇到了一些问题,但是我设法解决了该问题。 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. 我得到GET http://localhost/Edit/GetQuestions 404 (Not Found) ,其中Edit是控制器。 The application works when I run from VSTO 2013 without any issue, but it can't find the MVC4 controller once deployed. 当我从VSTO 2013运行时,该应用程序可以正常运行,但是一旦部署,它就找不到MVC4控制器。 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. 我在网址中添加了“ ..”以测试是否可行,因为我必须这样做才能从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. 我用Google搜索,但找不到与我遇到的此问题相关的任何信息。

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 . 请参阅将Web应用程序身份验证更改为使用Windows身份验证 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. 事实证明,控制器或URL没有问题,是未建立的对SQL Server的身份验证无法检索数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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