I'm using the ReportViewer control included with Visual Studio 2010 on an ASP.NET page. The control has its processing mode set to Local, which means the control needs to save state in the session, which becomes a problem once I deploy to Azure with
multiple instances for the web role containing the ASP.NET page.
I've successfully been able to use the TableStorageSessionStateProvider in the ASPProviders project in the Windows Azure Training Kit to provide out-of-process session state in Azure, but now I'm trying to use the AppFabric Caching CTP instead. I've got
it all configured in my web.config (using the Microsoft.Web.DistributedCache.DistributedCacheSessionStateStoreProvider), but when the ReportViewer control attempts to access session state, I get the exception listed below. My guess is that the AppFabric caching
session state provider is serializing/deserializing the session in such a way that it doesn't like what the ReportViewer control is storing, unlike the TableStorageSessionStateProvider or the normal ASP.NET InProc sessions.
I don't have control over either the ReportViewer or the Microsoft.Web.DistributedCache.DistributedCacheSessionStateStoreProvider, so I'm not sure if this is something that can be addressed on the AppFabric side or not.
Server Error in '/' Application.
Type 'Microsoft.Reporting.WebForms.SyncList`1[[System.String, mscorlib, Version=188.8.131.52, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' is an invalid
collection type since it does not have a default constructor.
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.
System.Runtime.Serialization.InvalidDataContractException: Type 'Microsoft.Reporting.WebForms.SyncList`1[[System.String, mscorlib, Version=184.108.40.206, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' is an invalid collection type since it does not have
a default constructor.
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.
Thanks for the fedback - while we investigate this, please can you check if you are able to successfully use the Cache session provider to store the session state for a regular ASP.NET page as part of this Azure app? Once we have the web.config or other
config issues out of the way, we'll work with the ReportViewer team to narrow this down.
AF needs to have the capability to deserialize and serialize the object but unlike other "simpler" objects, we need to fulfill a few requirements before this can be done. In a sense, not all collections are directly supported. In your case it is
because a default constructor does not exist. The following article goes into great detail on how to go about it - http://msdn.microsoft.com/en-us/library/aa347850.aspx
and I have a dataCacheClient section earlier in the web.config as well. I was able to store a string as well as custom class objects, both with and without an explicit constructor, in the session and retrieve them as well.
Thanks for the update! In working with the ASP.NET team on the session state provider our early investigation tells us that we are hitting some issue with the use of NetDataContractSerializer because of which the complex data type used by the ReportViewer
is not getting serialized correctly. We'll continue this investigation and post back our findings and/or a solution soon.
Wanted to follow up on Karan's post earlier. This is a bug and we will consider it for fixing in a future release. As Jaime mentions earlier , the lack of default constructor on the object being cached is causing this issue and unfortunately no workarounds
exist since the object is not in your control.
Thanks for reporting this issue and we will consider it for our next release.
Marked As Answer byRichardIwThursday, January 27, 2011 4:02 PM
Thanks everyone for the investigation. It would be really useful to be able to get this fixed in a future release; right now it's looking like I'll have to have a worker role running in Azure to maintain and clean up whatever session solution I end up using
to get around this issue (be it in SQL or in table storage). It would be preferable to be able to use the AppFabric caching once it's released. Thanks again,
I am also having the same issue. It works fine when I create a separate solution for the reports but when I add the reports in the current project solution I am getting the same error. Any solution for this problem. Thanks!
Microsoft is conducting an online survey to understand your opinion of the Msdn Web site. If you choose to participate, the online survey will be presented to you when you leave the Msdn Web site.