Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 使用Ajax请求在MVC中上传Excel文件_Asp.net_Excel_Ajax_Model View Controller - Fatal编程技术网

Asp.net 使用Ajax请求在MVC中上传Excel文件

Asp.net 使用Ajax请求在MVC中上传Excel文件,asp.net,excel,ajax,model-view-controller,Asp.net,Excel,Ajax,Model View Controller,我正在尝试使用Ajax请求上载Excel文件 这是我的代码: $.ajax({ url: "/Configuration/ImportCPTMappingWithApptType", type: "POST", contentType: false, processData:

我正在尝试使用Ajax请求上载Excel文件

这是我的代码:

$.ajax({
                            url: "/Configuration/ImportCPTMappingWithApptType",
                            type: "POST",
                            contentType: false,
                            processData: false,
                            data: data1,
                            success: function (Message) {
                                Console.log(Message);
                                //$("#Products").html(Message);
                            },
                            failure: function (response) {
                                fnClosePageLoader();
                                fnErrormsg(response.responseText);
                            },
                            error: function (xhr, status, p3, p4) {
                                var err = "Error " + " " + status + " " + p3 + " " + p4;
                                if (xhr.responseText && xhr.responseText[0] == "{")
                                    err = JSON.parse(xhr.responseText).Message;
                                fnErrormsg(err);
                                alert(err);
                                return false;
                            }
                        });

但它抛出一个错误404 Not Found。可能是什么问题?

找不到名为“配置”的控制器,该控制器的方法为“ImportCPTMappingWithApptType”,该方法的属性为[HttpPost]

您需要检查路由,以找到方法的正确名称

一个老掉牙但很好的帮手是一个通病


当您在dev机器上运行时,它将为您提供项目中所有路由的详细信息,以及哪些路由(如果有的话)与路径匹配。

同样的ajax在HttpGet上运行良好。