Products Technologies Demo Docs Blog Support Company

Configuring ASP.NET and IIS for Larger Requests

Since we released the session-less version of the DocumentViewer, ASP.NET projects must be prepared for sending larger POST data when loading documents from memory.

Configuring ASP.NET and IIS for Larger Requests

The ASP.NET MVC DocumentViewer can be used to view all document types that are supported by TX Text Control including TX, DOC, DOCX, RTF and PDF.

TX Text Control MVC DocumentViewer

When loading documents using the JavaScript loadDocument method or when loading from memory directly in the MVC view code, the document will be sent to the server in a POST request. For larger documents, it is required to increase the size of data that can be send to the server.

There are 3 areas in the web.config file that have to be adjusted to accept larger POST requests:

  • IIS Request Filtering
  • HttpRuntime maxRequestLength
  • MaxJsonDeserializerMembers

IIS Request Filtering

On IIS level, the Request Filtering module is used to limit the size of data accepted by IIS. Increase the maxAllowedContentLength value that specifies the size of the POST buffer given in bytes.

The default size is 30000000 bytes (28.6 MB). Max value is 4294967295 bytes (4 GB)

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
     <security>
      <requestFiltering>
        <requestLimits maxAllowedContentLength="4294967295"  />
      </requestFiltering>
    </security>  
   </system.webServer>
</configuration>

HttpRuntime maxRequestLength

ASP.NET has its own setting to limit the size of uploads and requests. Use the maxRequestLength of the httpRuntime element.

The default size is 4096 kilobytes (4 MB). Max value 2,147,483,647 kilobytes (~82 Terabyte). The following setting defines a max size of 500 megabytes.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.web>
    <httpRuntime maxRequestLength="500000" executionTimeout="120" />
  </system.web>
</configuration>

Pay attention to the different units used by these settings. Request Filtering is in bytes and HttpRuntime maxRequestLength is given in kilobytes.

MaxJsonDeserializerMembers

All data is send as JSON objects in the DocumentViewer client-server communication. The number of properties in a posted JSON object needs to be adjusted using the aspnet:MaxJsonDeserializerMembers application setting:

<configuration>
  <appSettings>
    <add key="aspnet:MaxJsonDeserializerMembers" value="10000" />
  </appSettings>
</configuration>

By adjusting the above settings in your web.config, all document sizes can be loaded from memory.

Stay in the loop!

Subscribe to the newsletter to receive the latest updates.

ASP.NET

Integrate document processing into your applications to create documents such as PDFs and MS Word documents, including client-side document editing, viewing, and electronic signatures.

ASP.NET Core
Angular
Blazor
JavaScript
React
  • Angular
  • Blazor
  • React
  • JavaScript
  • ASP.NET MVC, ASP.NET Core, and WebForms

Learn more Trial token Download trial

Related Posts

ASP.NETDocument ViewerMVC

Updated MVC DocumentViewer: Session-less and Improved Image Quality

We published a new version of the ASP.NET MVC DocumentViewer that is now session-less and provides a better image quality.


ASP.NETASP.NET CoreDocument Viewer

High-Performance Text Replacement in Large DOCX Files using C# .NET

Learn how to efficiently replace text in large DOCX files using C# .NET and the ServerTextControl component from Text Control. This article demonstrates the performance benefits of using the…


ASP.NETASP.NET CoreDocument Viewer

Document Viewer 33.2.1 Released: New Event and Bug Fixes

This service pack includes important bug fixes and improvements to enhance the stability and performance of the Document Viewer. In addition, a new event has been introduced to provide developers…


ASP.NETASP.NET CoreDocument Viewer

Document Viewer: Long Polling Support for Loading Documents

The Document Viewer now supports long polling for loading documents. This allows an asynchronous loading of documents and is especially useful for large documents or slow connections.


ASP.NETReactDocument Editor

TX Text Control React Packages Released

We are very happy to announce the immediate availability of React packages for TX Text Control. The new packages are available on npm and provide a wide range of document processing features…