将App部署到实时服务器时出现500 Internal Server error - c#

我的ASP.Net Web应用程序在其中一个页面上上传了一个简单的Ajax文件,该文件在测试时可以在本地主机上正常运行,但是当我将其发布到网站时,出现500 Internal Server错误。以下是Google chrome控制台上的输出:

POST http://switchclothing.andrewmwest.co.uk/StoreManager/UploadFiles 500 (Internal Server Error) jquery-2.1.0.min.js:4
l.cors.a.crossDomain.send jquery-2.1.0.min.js:4
o.extend.ajax jquery-2.1.0.min.js:4
send jquery.fileupload.js:834
$.widget._onSend jquery.fileupload.js:896
(anonymous function) jquery-ui-1.10.4.js:401
data.submit jquery.fileupload.js:612
(anonymous function) jquery.fileupload.js:180
j jquery-2.1.0.min.js:2
k.add jquery-2.1.0.min.js:2
$.widget.options.add jquery.fileupload.js:179
$.Widget._trigger jquery-ui-1.10.4.js:785
(anonymous function) jquery.fileupload.js:935
o.extend.each jquery-2.1.0.min.js:2
$.widget._onAdd jquery.fileupload.js:928
(anonymous function) jquery-ui-1.10.4.js:401
(anonymous function) jquery.fileupload.js:1105
j jquery-2.1.0.min.js:2
k.add jquery-2.1.0.min.js:2
d.always jquery-2.1.0.min.js:2
$.widget._onChange jquery.fileupload.js:1099
(anonymous function) jquery-ui-1.10.4.js:401
handlerProxy jquery-ui-1.10.4.js:702
o.event.dispatch jquery-2.1.0.min.js:3
r.handle jquery-2.1.0.min.js:3

单击请求的URL,我在浏览器页面中收到此错误:

The resource cannot be found.

Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly. 

Requested URL: /StoreManager/UploadFiles

香港专业教育学院还附上我的代码如下:

[HttpPost]
        public JsonResult UploadFiles()
        {
            var r = new List<UploadFilesResult>();

            foreach (string file in Request.Files)
            {
                HttpPostedFileBase hpf = Request.Files[file] as HttpPostedFileBase;
                if (hpf.ContentLength == 0)
                    continue;

                string savedFileName = Url.Content(Path.Combine(Server.MapPath("~/Images"), Path.GetFileName(hpf.FileName)));

                var path = GetNewPathForDupes(savedFileName);

                hpf.SaveAs(path);

                r.Add(new UploadFilesResult()
                {
                    Name = "/Images/" + Path.GetFileName(path),
                    Length = hpf.ContentLength,
                    Type = hpf.ContentType
                });
            }
            return Json(r);
        }

        private string GetNewPathForDupes(string path)
        {
            string directory = Path.GetDirectoryName(path);
            string filename = Path.GetFileNameWithoutExtension(path);
            string extension = Path.GetExtension(path);
            int counter = 1;

            string newFullPath;

            do
            {
                string newFilename = "{0}({1}){2}".FormatWith(filename, counter, extension);
                newFullPath = Path.Combine(directory, newFilename);
                counter++;
            } while (System.IO.File.Exists(newFullPath));

            return newFullPath;
        } 

我的HTML和javascript代码:

$(document).ready(function () {
            $('#fileupload').fileupload({
                dataType: 'json',
                url: "/StoreManager/UploadFiles",
                autoUpload: true,
                done: function (e, data) {
                    var json = data.result[0];

                    $("#picurl").val(json['Name']);

                    $('.file_name').html(json['Name']);
                    $('.file_type').html(json['Type']);
                    $('.file_size').html(json['Length']);
                }
            }).on('fileuploadprogressall', function (e, data) {
                var progress = parseInt(data.loaded / data.total * 100, 10);
                $('.progress .progress-bar').css('width', progress + '%');
            });
        });


@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()

    <div class="form-horizontal">
        <h4>Footwear</h4>
        <hr />
        @Html.ValidationSummary(true)
        @Html.HiddenFor(model => model.FootwearId)

        <div class="form-group">
            @Html.LabelFor(model => model.Name, new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.Name)
                @Html.ValidationMessageFor(model => model.Name)
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.Price, new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.Price)
                @Html.ValidationMessageFor(model => model.Price)
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.FootwearPicUrl, new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.TextBoxFor(model => model.FootwearPicUrl, new { @id = "picurl", @readonly = "readonly" })
                @Html.ValidationMessageFor(model => model.FootwearPicUrl)
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.Colour, new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.Colour)
                @Html.ValidationMessageFor(model => model.Colour)
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.DepartmentId, "DepartmentId", new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.DropDownList("DepartmentId", String.Empty)
                @Html.ValidationMessageFor(model => model.DepartmentId)
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.BrandId, "BrandId", new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.DropDownList("BrandId", String.Empty)
                @Html.ValidationMessageFor(model => model.BrandId)
            </div>
        </div>

        <div class="form-group">
            <div class="col-md-offset-2 col-md-10">
                <input type="submit" value="Save" class="btn btn-default" />
            </div>
        </div>
    </div>
}

<span class="btn btn-success fileinput-button">
    <i class="glyphicon glyphicon-plus"></i>
    <span>Add files...</span>
    <input id="fileupload" type="file" name="files[]">
</span>
<br />
<div class="progress">
    <div class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;">
        <span class="sr-only">0% complete</span>
    </div>
</div>
<br />
<div class="file_name"></div>
<br />
<div class="file_type"></div>
<br />
<div class="file_size"></div>

参考方案

浏览服务器设置后,我看到写权限被禁用。启用AJAX后,上传将按预期工作。

将python scikit学习模型导出到pmml - python

我想将python scikit-learn模型导出到PMML。哪个python软件包最合适?我阅读了有关Augustus的内容,但是我无法使用scikit-learn模型找到任何示例。 python大神给出的解决方案 SkLearn2PMML是 JPMML-SkLearn命令行应用程序周围的薄包装。有关受支持的Scikit-Learn Estimator和…

故障排除“警告:session_start():无法发送会话高速缓存限制器-标头已发送” - php

我收到警告:session_start()[function.session-start]:无法发送会话缓存限制器-标头已发送(错误输出开始如果我将表单数据提交到其他文件进行处理,则可以正常工作。但是,如果我将表单数据提交到同一页面,则会出现此错误。请建议<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0…

SOAPFaultException部署在Tomcat上时,但在GlassFish中工作正常 - java

朋友们,我一直在尝试很多,阅读了很多论坛,但无法理解为什么出现此问题。我使用契约优先方法创建了一个Jax-WS WebService。创建WSDL和XSD,然后使用wsimport工具生成其余工件,为SEI提供实现。将WebService应用程序部署到Eclipse Helios中的GlassFish(Glassfish适配器和Eclipse中安装的插件)。…

Telerik单选按钮所需的字段验证器 - javascript

如何设置Telerik单选按钮所需的字段验证器?我想在按钮单击“ BtnSave”上设置必填字段验证器吗?请帮忙!<telerik:RadButton ID="radio_male" runat="server" ToggleType="Radio" AutoPostBack="fa…

Div单击与单选按钮相同吗? - php

有没有一种方法可以使div上的click事件与表单环境中的单选按钮相同?我只希望下面的div提交值,单选按钮很丑代码输出如下:<input id="radio-2011-06-08" value="2011-06-08" type="radio" name="radio_date&#…