简体   繁体   English

我的 MVC 项目在 web 服务器中部署后不起作用

[英]My MVC project doesn't work after deploying it in the web server

I'm working on an ASP.NET MVC project that uses a fullcalendar jQuery.我正在研究一个使用 fullcalendar jQuery 的 ASP.NET MVC 项目。 The project runs perfectly in Visual Studio without any error.该项目在 Visual Studio 中完美运行,没有任何错误。 After I deployed the project to a web server, I get this error:在我将项目部署到 web 服务器后,我收到此错误:

Get http://.... 404 (not found)   

error错误

I'm using Visual Studio 2017 and web server 2012.我正在使用 Visual Studio 2017 和 web 服务器 2012。

The error occurs in this part of the code:错误出现在这部分代码中:

$.ajax({
        type: "GET",
        url: "/event/GetEvents",
        success: function (data) {
            $.each(data, function (i, v) {
                events.push({
                            eventID: v.EventID,
                            title: v.Subject,
                            description: v.Description,
                            start: moment(v.Start),
                            end: v.Finish != null ? moment(v.Finish) : null,
                            color: v.ThemeColor,
                            allDay: v.IsFullDay
                });
            })

            GenerateCalender(events);
        },
        error: function (error) {
            alert('failed');
        }
    })

failed all the time.一直失败。 This is my first time to work with ASP.NET MVC.这是我第一次使用 ASP.NET MVC。

Is there any specific way to deploy the project in the server or is there any thing missing to be added?是否有任何特定方法可以在服务器中部署项目,或者是否缺少任何要添加的内容? Or do I need to change some settings on the server?还是我需要更改服务器上的一些设置?

I think that you should render right js files in BundleConfig.cs, maybe you can publish your website with all files like Controllers, Views, Models etc.我认为您应该在 BundleConfig.cs 中呈现正确的 js 文件,也许您可以使用所有文件(如控制器、视图、模型等)发布您的网站。

示例 BundleConfig.cs 配置 示例发布选项 示例发布配置文件

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

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