System.IO.IsolatedStorage.IsolatedStorageException:无法确定域的标识.
我确认可以将报表从Report Manager导出到Excel 2007-2013 XLSX OpenXML渲染扩展,没有任何问题.仅在通过订阅执行报表时才会出现此错误.我研究了这个并在网上找到了以下建议:
>两个单独的Microsoft Connect错误报告764356和764556没有列出的解决方法.
>建议错开订阅,以便一次只运行一个订阅.这没有用,因为在发生错误时只运行了一个订阅.
>建议使用Excel 2003呈现方法并将行分成单独的选项卡以避免65,536行限制.我确实证实了这一点,但从业务利益相关者的角度来看,这不是一个可接受的解决方案.
>注释表示使用Excel 2007-2013渲染方法的任何报告,其大小超过10 MB,从在内存中生成切换到使用独立存储.没有解释为什么这是坏的,我认为这是有充分理由 – 也许是为了限制RAM消耗.
>建议在ASP.NET应用程序的Isolated Storage文件夹中提升用户的权限.我找不到Isolated Storage文件夹在Reporting Services中的位置.
>建议使用额外的代码包装ASP.NET的隔离存储代码,以绕过此问题.我找不到将此解决方案应用于Reporting Services的方法,因为这是Microsoft发布的产品.
>建议修改Report Manager和Report Server web.config文件,以在httpRuntime节点中包含maxRequestLength =“200000”.这没有改变结果.
>建议在RSReportServer.config中显式增加内存设置.这似乎不会有所帮助,因为错误与隔离存储有关,但我尝试了它的解压缩.这没有改变结果.
>建议将DatabaseQueryTimeout值从120更改为更大的值.这没有改变结果.
>建议更改订阅执行超时值.这没有改变结果.
以下是完整错误日志条目的副本:
reportrendering!WindowsService_5!1628!04/03/2013-09:48:33:: e ERROR: Throwing Microsoft.ReportingServices.ReportProcessing.UnhandledReportRenderingException:,Microsoft.ReportingServices.ReportProcessing.UnhandledReportRenderingException: An error occurred during rendering of the report. ---> Microsoft.ReportingServices.OnDemandReportRendering.ReportRenderingException: An error occurred during rendering of the report. ---> System.IO.IsolatedStorage.IsolatedStorageException: Unable to determine the identity of domain. at System.IO.IsolatedStorage.IsolatedStorage._GetAccountingInfo(Evidence evidence,Type evidenceType,IsolatedStorageScope fAssmDomApp,Object& oNormalized) at System.IO.IsolatedStorage.IsolatedStorage.GetAccountingInfo(Evidence evidence,String& typeName,String& instanceName) at System.IO.IsolatedStorage.IsolatedStorage._InitStore(IsolatedStorageScope scope,Evidence domainEv,Type domainEvidenceType,Evidence assemEv,Type assemblyEvidenceType,Evidence appEv,Type appEvidenceType) at System.IO.IsolatedStorage.IsolatedStorage.InitStore(IsolatedStorageScope scope,Type assemblyEvidenceType) at System.IO.IsolatedStorage.IsolatedStorageFile.GetStore(IsolatedStorageScope scope,Type assemblyEvidenceType) at MS.Internal.IO.Packaging.PackagingUtilities.ReliableIsolatedStorageFileFolder..ctor() at MS.Internal.IO.Packaging.PackagingUtilities.GetDefaultIsolatedStorageFile() at MS.Internal.IO.Packaging.PackagingUtilities.CreateUserScopedIsolatedStorageFileStreamWithRandomName(Int32 retryCount,String& fileName) at MS.Internal.IO.Packaging.SparseMemoryStream.EnsureIsolatedStoreStream() at MS.Internal.IO.Packaging.SparseMemoryStream.SwitchModeIfNecessary() at MS.Internal.IO.Zip.ZipIOFileItemStream.Write(Byte[] buffer,Int32 offset,Int32 count) at System.IO.Compression.DeflateStream.InternalWrite(Byte[] array,Int32 count,Boolean isAsync) at System.IO.Compression.DeflateStream.Write(Byte[] array,Int32 count) at MS.Internal.IO.Packaging.CompressStream.Write(Byte[] buffer,Int32 count) at MS.Internal.IO.Zip.ProgressiveCrcCalculatingStream.Write(Byte[] buffer,Int32 count) at MS.Internal.IO.Zip.ZipIOModeEnforcingStream.Write(Byte[] buffer,Int32 count) at Microsoft.ReportingServices.Rendering.ExcelOpenXmlRenderer.XMLModel.XMLStreamsheetModel.WriteStreamToStream(Stream from,Stream to) at Microsoft.ReportingServices.Rendering.ExcelOpenXmlRenderer.XMLModel.XMLStreamsheetModel.Cleanup() at Microsoft.ReportingServices.Rendering.ExcelOpenXmlRenderer.OpenXmlGenerator.FinalizeWorksheet() at Microsoft.ReportingServices.Rendering.ExcelOpenXmlRenderer.OpenXmlGenerator.NextWorksheet() at Microsoft.ReportingServices.Rendering.ExcelRenderer.ExcelRenderer.Render(Report report,NameValueCollection reportServerParameters,NameValueCollection deviceInfo,NameValueCollection
解决方法
在COM组件中,使用适当的证据创建一个新的AppDomain并执行该代码.
AppDomainSetup setup = new AppDomainSetup(); setup.ApplicationBase = AppDomain.CurrentDomain.BaseDirectory.ToString(); //Then we need our evidence System.Security.Policy.Evidence evidence = new System.Security.Policy.Evidence(); evidence.AddHost(new System.Security.Policy.Zone(System.Security.SecurityZone.MyComputer)); //Now we can fire up an AppDomain running with that evidence. AppDomain domain = AppDomain.CreateDomain("YourDll.YourClass",evidence,setup); YourDll.YourClass yourclass = (YourDll.YourClass)domain.CreateInstanceAndUnwrap(typeof(YourDll.YourClass).Assembly.FullName,typeof(YourDll.YourClass).FullName); yourclass.CallYourMethod();
要在AppDomains上编组的任何类型都必须标记为[Serializable()],并且必须从MarshalByRefObject继承.
例如:
namespace YourDll { [Serializable()] public class YourClass: MarshalByRefObject { ...