Isolated Storage Exception: Unable to determine the identity of domain

前端 未结 1 1524
[愿得一人]
[愿得一人] 2020-12-19 09:14

I setup a subscription in a SQL Server 2012 SP1 Reporting Services instance that exports a 34MB file to the Excel 2007-2013 XLSX OpenXML render extension. The subscription

相关标签:
1条回答
  • 2020-12-19 09:39

    You can find a solution here: http://rekiwi.blogspot.com/2008/12/unable-to-determine-identity-of-domain.html

    In the COM component, create a new AppDomain with the appropriate evidence and execute the code in that.

    Here is a code example that fixed the problem for me:

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

    Any types you want to marshall across AppDomains have to marked [Serializable()] and must inherit from MarshalByRefObject. For example:

    namespace YourDll
    {
    [Serializable()]
    public class YourClass: MarshalByRefObject
    {
    ...
    
    0 讨论(0)
提交回复
热议问题