我正在使用 JUpload ( http://jupload.sourceforge.net/ ) 来处理文件上传,因为我需要选择一个文件夹并上传其中的所有文件。无论如何,我的问题是使用相同的代码,在 IIS7 文件上传工作和使用 Asp Net 开发服务器(MS Visual Studio 2010)上传将失败(错误消息:“字符串 '^SUCCESS$' 是在响应正文中找不到”)。
我的代码如下所示:
public ActionResult UploadTest(HttpPostedFileBase file)
{
Debug.WriteLine("ContentType: " +Request.ContentType + " HttpMethod: " + Request.HttpMethod);
Debug.WriteLine("File is null ?: " + (file == null));
Response.StatusCode = 200;
if (file != null)
{
Debug.WriteLine("filename: " + file.FileName + " size: " + file.ContentLength + " Type: " + file.ContentType);
Response.Write(file.FileName);
}
Response.Write("\n");
return Content("SUCCESS");
}
JUpload 的日志在开发服务器中显示了这一点:
_http://paste-it.net/public/j6608f6/
这是来自 IIS7
http://paste-it.net/public/f51cbb7/
从我看到的文件通过控制器传递,但在开发服务器中似乎有一个额外的 HTTP 代码 100 正在引入错误。
我很乐意提出任何建议:)