2013-02-19 62 views
0

我正在使用fineuploader上传文件。对于200MB以下的文件,一切正常。一切都失败了。创建一个新文件,但它是空的(意思是0kb)上传文件在.net MVC

已经修改我的web.config允许上传500mb。但似乎没有帮助。

的web.config:

<security> 
     <requestFiltering> 
      <requestLimits maxAllowedContentLength="524288000" /> 
     </requestFiltering> 
    </security> 

<httpRuntime targetFramework="4.5" maxRequestLength="512000" executionTimeout="900" requestLengthDiskThreshold="512000" /> 

控制器:200MB以上

[HttpPost] 
public ActionResult Upload(string qqfile) 
{ 
    try 
    { 
     Stream stream = Request.Files.Count > 0 ? Request.Files[0].InputStream : Request.InputStream; 

     string filePath = Path.Combine(@"C:\Temp\100", qqfile); 
     using (Stream file = System.IO.File.OpenWrite(filePath)) 
     { 
      stream.CopyTo(file); 
     } 
.... 

为什么我不能上传文件?

+0

http://forums.asp.net/t/1646283.aspx/1和http://stackoverflow.com/a/6472631/118298 2可能有所帮助 – Yasser 2013-02-19 17:02:40

回答

0

想通了: 这是一个web.config设置:

的web.config:

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

<system.webServer> 
     <security> 
      <requestFiltering> 
       <requestLimits maxAllowedContentLength="4294967295" /> 
      </requestFiltering> 
     </security> 
    </system.webServer> 

感谢阿拉法特指着我在正确的方向

0

首先想到的是IIS中的限制。在IIS7中的“集成模式”之前,必须处理IIS-MetaBase以设置IIS属性。

如果您在“集成模式”下运行网站或使用VS Development Webserver(基于Cassini),它可能会工作,如果您在“经典模式”下运行生产,它将不使用集成配置并回到元数据库。如果是,并且您尚未编辑元数据库,则通过默认元数据库上传限制进行的任何上传都将失败。

从你的代码/配置/问题我不能确定你有问题的网站正在运行的模式 - 这可能是至关重要的回答你的问题 - 所以请提供这些细节。