How to upload large report files in CRM

If you have a report file in CRM that is larger than 4MB, you will get an annoying and nondescript error when you try to upload it.

The default report size in CRM 4 (and I think CRM 2011 as well).  This article – Report and Snapshot Size Limits, this section explains about the maximum size and why it is set to 4MB

Maximum Size for Published Reports and Models

On the report server, report and model size is based on the size of the report definition (.rdl) and report model (.smdl) files that you publish to a report server. The report server does not limit the size of a report or model that you publish. However, Microsoft ASP.NET imposes a maximum size for items that are posted to the server. By default, this limit is 4 megabytes (MB). If you upload or publish a file that exceeds this limit to a report server, you receive an HTTP exception. In this case, you can modify the default by increasing the value of the maxRequestLength element in the Machine.config file.

Although a report model might be very large, report definitions rarely exceed 4 MB. A more typical report size is in the order of kilobytes (KB). However, if you include embedded images, the encoding of those images can result in large report definitions that exceed the 4 MB default.

ASP.NET imposes a maximum limit on posted files to reduce the threat of denial-of-service attacks against the server. Increasing the value of the upper limit undermines some of the protection that this limit provides. Increase the value only if you are confident that the benefit of doing so outweighs any additional security risk.

Now if you have some pictures in your report it can easily go above 4MB but when you try to upload the report you will get an error.  You will need to configure the report services, although in this case someone else did this some I’m not entirely sure what had to be changed.  I guess you will need to up the memory, these two links should help with that.

Configuring Available Memory for Report Server Applications

http://msdn.microsoft.com/en-us/library/ms159206.aspx

How to: Modify a Reporting Services Configuration File

http://msdn.microsoft.com/en-us/library/bb630448.aspx

You also need to change some web.config settings for the Microsoft Dynamics CRM website, to up the limit from 4MB’s.

This forum post had a good response to what settings you should change, I found you needed to make this change the CRM web.config.

Increasing the maxRequestLength under httpRuntime in web.config file of reporting services will help.  The default value is 4MB, however, base64 encoding used by RS has an overhead of approximately 25%, so the actual limit will be hit at around 3.2MB.

e.g. to increase the maxRequestLength to 20MB:

<httpRuntime executionTimeout = “9000” maxRequestLength=”20480″ />

My college also sent me this email, although I’m not sure where he got it from but it basically says something similar to the line above.  I not so sure about changing the machine.configs but you may need to so I have included it.

The root of the problem here was .NET. Nothing changed when editing the web.config files. However, there were two machine.config files on the server in the following locations:

C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\CONFIG

and

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG

The machine.config in the v1.1.4322 folder had exactly what I was looking for with comments on what to replace. But changes these settings will not affect anything. Changing the machine.config for v2.0.50727 will have an affect. The reason why this is, is because IIS was using ASP.net v2.0.50727 (but changing IIS to use 1.1 did not accomplish anything). Now the strange thing about the 2.0.5 version was that it did not have any of the parameters already in it that I needed, so I skipped over it when my search didn’t find maxRequestLength (my mistake there).

HERE IS THE FIX

1. Go to C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG
2. Open machine.config
3. Search for <system.web>
4. Add in <httpRuntime executionTimeout=”9000″ maxRequestLength=”102400″ /> under the <system.web> (I added it right before the end)
5. Save
6. Restart IIS

That should fix the problem. I attached the code that I edited so you know what to look for. The first part is from the file that doesn’t affect anything but tells you what everything does. The second part is the part that I edited and fix everything with.

1: 

2:

3:

4:

5:

6:

7:

8:

9:

10:

11:

12:

13:

14:

15:

16:

17:

18:

19:

20:

21:

22:

23:

24:

25:

26:

27:

28:

29:

30:

31:

32:

33:

34:

35:

36:

37:

38:

39:

40:

41:

42:

43:

44:

45:

–v1.1.4322 

httpRuntime Attributes:

executionTimeout=”[seconds]” – time in seconds before request is automatically timed out

maxRequestLength=”[KBytes]” – KBytes size of maximum request length to accept

useFullyQualifiedRedirectUrl=”[true|false]” – Fully qualifiy the URL for client redirects

minFreeThreads=”[count]” – minimum number of free thread to allow execution of new requests

minLocalRequestFreeThreads=”[count]” – minimum number of free thread to allow execution of new local requests

appRequestQueueLimit=”[count]” – maximum number of requests queued for the application

enableKernelOutputCache=”[true|false]” – enable the http.sys cache on IIS6 and higher – default is true

enableVersionHeader=”[true|false]” – outputs X-AspNet-Version header with each request

–>

<httpRuntime executionTimeout=”1200″

maxRequestLength=”102400″

useFullyQualifiedRedirectUrl=”false”

minFreeThreads=”8″

minLocalRequestFreeThreads=”4″

appRequestQueueLimit=”100″

enableVersionHeader=”true”

/>

–v2.0.50727

<system.web>

<processModel autoConfig=”true”/>

<httpHandlers/>

<membership>

<providers>

<add name=”AspNetSqlMembershipProvider” type=”System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” connectionStringName=”LocalSqlServer” enablePasswordRetrieval=”false” enablePasswordReset=”true” requiresQuestionAndAnswer=”true” applicationName=”/” requiresUniqueEmail=”false” passwordFormat=”Hashed” maxInvalidPasswordAttempts=”5″ minRequiredPasswordLength=”7″ minRequiredNonalphanumericCharacters=”1″ passwordAttemptWindow=”10″ passwordStrengthRegularExpression=””/>

</providers>

</membership>

<profile>

<providers>

<add name=”AspNetSqlProfileProvider” connectionStringName=”LocalSqlServer” applicationName=”/” type=”System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”/>

</providers>

</profile>

<roleManager>

<providers>

<add name=”AspNetSqlRoleProvider” connectionStringName=”LocalSqlServer” applicationName=”/” type=”System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”/>

<add name=”AspNetWindowsTokenRoleProvider” applicationName=”/” type=”System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”/>

</providers>

</roleManager>

<httpRuntime executionTimeout=”9000″ maxRequestLength=”102400″ />

</system.web>

6 thoughts on “How to upload large report files in CRM

  1. santosh bhagat June 5, 2012 / 9:35 am

    After doing so ,i have to restart dynamic server or not

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s