绕过2GB上传限制IIS

时间:2016-09-17 19:51:26

标签: c# asp.net .net iis sharepoint-2010

IIS(7)阻止我从客户端(asp.net代码 - .NET 3.5)上传到我的服务器(sharepoint),因为该文件大于2GB。根据我对网络的研究,这似乎是极限。

那么我们如何绕过这个限制?

客户代码:

string urlFile = "xxxxx"

Stream input = Telechargeur.FileContent
Stream output = new FileStream(urlFile,FileMode.OpenOrCreate)

byte[] buffer = new byte[1024*1024*5]
int nbRead = -1

while((nbRead = input.Read(buffer,0,buffer.Length))>0)
{
  output.Write(buffer,0,nbRead);
  output.Flush();

}

input.Close();
output.Close();

服务器代码:

string urlFile = "xxx"

Stream input = context.Request.InputStream; Stream output =  new FileStream(urlFile,FileMode.OpenOrCreate)

byte[] buffer = new byte[1024*1024*5]
    int nbRead = -1

    while((nbRead = input.Read(buffer,0,buffer.Length))>0)
    {
      output.Write(buffer,0,nbRead);
      output.Flush();

    }

    input.Close();
    output.Close();

非常感谢

1 个答案:

答案 0 :(得分:1)

由于您没有说明您使用的是哪个版本的SharePoint,我将假设2013年。请参阅Technet article on Software boundaries and limits for SharePoint 2013这是SharePoint设计中的架构限制,无法绕过它。你试图在这里颠覆的实际上是文章中用来定义什么是"边界"是:

Boundaries are absolute limits that cannot be exceeded by design. It is
important to understand these limits to ensure that you do not make 
incorrect assumptions when you design your farm.

An example of a boundary is the 2 GB document size limit; you cannot 
configure SharePoint Server 2013 to store documents that are larger than 2 
GB. This is a built-in absolute value, and cannot be exceeded by design.  

即使您可以说服SharePoint让您绕过限制,这也是一个非常糟糕的主意,因为它会使您的服务器场处于不受支持的状态。这意味着,当您通过一些奇怪的问题呼叫支持以及您所做的事情被发现时,您将被告知在您正确重建之前,您将无法获得该服务器场的支持。

我也想到RBS可能会让你绕过这个限制。对不起,那也不会这样做:

enter image description here