我在SQL Server 2012 SP1 Reporting Services实例中设置了一个订阅,该实例将34MB文件导出到Excel 2007-2013 XLSX OpenXML呈现扩展名。订阅引发以下错误:

System.IO.IsolatedStorage.IsolatedStorageException:无法确定域的身份。

我验证了可以将报告从报告管理器导出到Excel 2007-2013 XLSX OpenXML呈现扩展名,而不会出现问题。仅当通过订阅执行报告时,才会发生此错误。我对此进行了研究,并在网上找到了以下建议:

  • 两个单独的Microsoft Connect错误报告764356764556没有列出的解决方法。
  • 一种建议,使订阅交错,以便一次仅运行一个订阅。这无济于事,因为在发生错误时,只有一个订阅正在运行。
  • 建议使用Excel 2003渲染方法并将行分成单独的选项卡,以避免65,536行的限制。我确实验证了这项工作,但是从业务利益相关者的角度来看,这不是可接受的解决方案。
  • 注释表示使用Excel 2007-2013呈现方法的任何报告的大小超过10 MB时,都会从内存中生成切换为使用隔离存储。没有任何解释说明为什么这样做不好,我认为这样做是有充分理由的-也许是为了限制RAM的消耗。
  • 建议为ASP.NET应用程序的“隔离存储”文件夹中的用户提升权限。我找不到“Reporting Services”的“隔离存储”文件夹的位置。
  • 建议使用绕过此问题的额外代码包装ASP.NET的“隔离存储”代码。我找不到将这种解决方案应用于Reporting Services的方法,因为这是Microsoft附带的产品。
  • 建议修改报表管理器和报表服务器的web.config文件,以在httpRuntime节点中包括m​​axRequestLength =“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, Type evidenceType, IsolatedStorageScope fAssmDomApp, 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 domainEvidenceType, Type assemblyEvidenceType)
       at System.IO.IsolatedStorage.IsolatedStorageFile.GetStore(IsolatedStorageScope scope, Type domainEvidenceType, 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 offset, Int32 count, Boolean isAsync)
       at System.IO.Compression.DeflateStream.Write(Byte[] array, Int32 offset, Int32 count)
       at MS.Internal.IO.Packaging.CompressStream.Write(Byte[] buffer, Int32 offset, Int32 count)
       at MS.Internal.IO.Zip.ProgressiveCrcCalculatingStream.Write(Byte[] buffer, Int32 offset, Int32 count)
       at MS.Internal.IO.Zip.ZipIOModeEnforcingStream.Write(Byte[] buffer, Int32 offset, 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
    

    最佳答案

    您可以在此处找到解决方案:http://rekiwi.blogspot.com/2008/12/unable-to-determine-identity-of-domain.html

    在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();
    

    您想要跨AppDomain编码(marshal)的任何类型都必须标记为[Serializable()],并且必须继承自MarshalByRefObject。
    例如:
    namespace YourDll
    {
    [Serializable()]
    public class YourClass: MarshalByRefObject
    {
    ...
    

    关于sql-server - 隔离存储异常: Unable to determine the identity of domain,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/15795458/

    10-13 06:38