Android 浏览器无法上传文件

File upload doesn't works from Android browser

文件上传在 Android 浏览器中不起作用,但在 PC 浏览器中可以正常工作。我的 MVC 代码在本地 IIS Express 中运行良好

 [HttpPost]
public string UploadJson(string id)
{

    try
    {
        string uploadFial = "noSave";
        if (Request.Files.Count > 0)
        {
            var file = Request.Files[0];

            if (file != null && file.ContentLength > 0)
            {
                if (string.IsNullOrWhiteSpace(id)) id = Request.Params["id"];
                string fileName = id + Path.GetExtension(file.FileName);
                string path =  Path.Combine(Server.MapPath("~/Images/"), fileName);
                logPath = Path.Combine(Server.MapPath("~/Images/"), "log.txt");
                file.SaveAs(path);
                return (Request.Url.ToString().Replace(Request.RawUrl.ToString(), "")
              + "/Images/" + fileName);
            }
            else { return (uploadFial); }
        }
        else
        { return (uploadFial); }
    }
    catch (Exception e)
    {

        saveLog(  e.InnerException + "stack trace **" + e.StackTrace+"data **" +e.Data.ToString());
        throw e;
    }

}

<form action="~/Home/UploadJson/" id="form6" enctype="multipart/form-data" data_ajax="false" method="post">
    <input type="file" name="file" />
    <input type="submit" value="upload file ready" />
</form>

我也在网络配置服务器中设置:

<httpRuntime targetFramework="4.5" maxRequestLength="2147483647" executionTimeout="1600" requestLengthDiskThreshold="2147483647" />

但是无法将文件从 Android 浏览器上传到 IIS 服务器。

与编程无关问题是包的大小是为服务器上的 MUT 设置的 解决了在服务器命令提示符下将 MUT 大小设置为默认值 1350

netsh interface ipv4 set subinterface 10 mtu=1350 store=persistent