执行文件上载时出错

时间:2016-04-22 20:02:48

标签: c# sql asp.net sql-server web

在图像上传时执行项目期间,浏览器显示此错误。 我使用SQl Server作为数据库。

`Server Error in '/' Application.
Maximum request length exceeded.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
Exception Details: System.Web.HttpException: Maximum request length exceeded.
Source Error: 
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace: 
[HttpException (0x80004005): Maximum request length exceeded.]
   System.Web.HttpRequest.GetEntireRawContent() +9803702
   System.Web.HttpRequest.GetMultipartContent() +63
   System.Web.HttpRequest.FillInFormCollection() +160
   System.Web.HttpRequest.EnsureForm() +69
   System.Web.HttpRequest.get_Form() +13
   System.Web.HttpRequest.get_HasForm() +9800635
   System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull) +95
   System.Web.UI.Page.DeterminePostBackMode() +69
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +220
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1073.0`

在SQl Server的文件上传期间是否有任何限制限制?

1 个答案:

答案 0 :(得分:2)

您的Web服务器而不是SQL服务器引发此错误。

如果您使用的是IIS,则可以修改web.config以允许上传大文件。

<configuration>
    <system.web>
        <httpRuntime maxRequestLength="xxxxxx" />
    </system.web>
</configuration>

对于IIS 7及更高版本,请使用以下内容..

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

以上示例取自here

另外,请阅读this