none
System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed

    Question

  • I have a class library, which is used in Sql Server Reporting Services to pull Value from a XML file. It is placed in "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies" folder. However, when i use the function in Class Libary it gives me exception

    System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed

    When I use the same code in a Console Application it works fine.
    I tried giving Full Access to every one on the file which is being accessed from Class Library. It still does not work. 
    Again i tried elevating the permission for the Assembly from MS DOT NET Config to highest level still no luck.
    Can any one help please.

    It is not the "times of triumph" but the "times of trial" which separate men from boys
    • Moved by Bin-ze Zhao Tuesday, December 29, 2009 7:13 AM (From:Visual C# General)
    Saturday, December 26, 2009 7:02 PM

Answers

  • A more precise answer would help Malange.
    It is not the "times of triumph" but the "times of trial" which separate men from boys
    http://social.msdn.microsoft.com/Forums/en/clr/thread/436a125b-675a-4897-abce-624c92d7fb1c
    Just Be Humble Malange!
    Saturday, December 26, 2009 8:38 PM
  • Hi BusyBee,

    By the way, executing custom code is a unattended report processing. Unattended report processing refers to any report execution process that is triggered by an event (either a schedule-driven event or data refresh event) rather than a user request. The report server uses the unattended report processing account to log on to the computer that hosts the external data source. This account is necessary because the credentials of the Report Server service account are never used to connect to other computers.

    Reporting Services provides a special account named “Execution Account” that is used for unattended report processing and for sending connection requests across the network.

    So, please also a account  that have permissions on the folder for “Execution Account”.  We can use Reporting Services Configuration Manager to set the Execution Account.

    Thanks,
    Jin Chen


    Jin Chen - MSFT
    Tuesday, December 29, 2009 9:43 AM
    Moderator
  • Hi Jin,

            Many thanks for your answers and sharing the knowledge. I did manage to solve the problem by putting the assembly in GAC. It has been working fine after that. But your answers certainly imparts knowledge.

    Cheers,

    Bhupendra


    It is not the "times of triumph" but the "times of trial" which separate men from boys
    Tuesday, December 29, 2009 9:47 AM

All replies

  • I have a class library, which is used in Sql Server Reporting Services to pull Value from a XML file. It is placed in "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies" folder. However, when i use the function in Class Libary it gives me exception

    System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed

    When I use the same code in a Console Application it works fine.
    I tried giving Full Access to every one on the file which is being accessed from Class Library. It still does not work. 
    Again i tried elevating the permission for the Assembly from MS DOT NET Config to highest level still no luck.
    Can any one help please.

    It is not the "times of triumph" but the "times of trial" which separate men from boys
    have a look here please:


    Just Be Humble Malange!
    Saturday, December 26, 2009 8:21 PM
  • A more precise answer would help Malange.
    It is not the "times of triumph" but the "times of trial" which separate men from boys
    Saturday, December 26, 2009 8:35 PM
  • A more precise answer would help Malange.
    It is not the "times of triumph" but the "times of trial" which separate men from boys
    http://social.msdn.microsoft.com/Forums/en/clr/thread/436a125b-675a-4897-abce-624c92d7fb1c
    Just Be Humble Malange!
    Saturday, December 26, 2009 8:38 PM
  • I have already tried that, it does not help
    It is not the "times of triumph" but the "times of trial" which separate men from boys
    Saturday, December 26, 2009 8:47 PM
  • Hi BusyBee,

    From the message you have post, I am sure the issue is caused by Code Access Serurity.

    Code access security centers around these core concepts: evidence, code groups, and named permission sets. In Reporting Services, the Report Manager, Report Designer, and Report Server components each have a policy file that configures code access security for custom assemblies as well as data, delivery, rendering, and security extensions.

    So, to solve the issue, we need to provide a Code Access security group for this assembly:
    1.Open the rssrvpolicy.config file using TextEditor(such as Notepad)
    By default, the file is located at: C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportServer
    2.Add a code group to the configuration file. We set the permission of the assembly to be FullTrust.
    <CodeGroup class="UnionCodeGroup"
       version="1"
       PermissionSetName="FullTrust"
       Name="MyCodeGroup"
       Description="Code group for my data processing extension">
          <IMembershipCondition class="UrlMembershipCondition"
             version="1"
             Url="C:\Program Files\Microsoft SQL Server\MSSQL\Reporting Services\ReportServer\bin\Microsoft.Samples.ReportingServices.FsiDataExtension.dll"
           />
    </CodeGroup>


    Note, please add the code group under this section:
       <CodeGroup 
                                    class="FirstMatchCodeGroup" 
                                    version="1" 
                                    PermissionSetName="FullTrust"
                                    Description="This code group grants MyComputer code Execution permission. ">


    For more information, please see:
    http://msdn.microsoft.com/en-us/library/ms154658.aspx

    If there is anything unclear, please feel free to ask.

    Thanks,
    Jin Chen
    Jin Chen - MSFT
    Tuesday, December 29, 2009 9:40 AM
    Moderator
  • Hi BusyBee,

    By the way, executing custom code is a unattended report processing. Unattended report processing refers to any report execution process that is triggered by an event (either a schedule-driven event or data refresh event) rather than a user request. The report server uses the unattended report processing account to log on to the computer that hosts the external data source. This account is necessary because the credentials of the Report Server service account are never used to connect to other computers.

    Reporting Services provides a special account named “Execution Account” that is used for unattended report processing and for sending connection requests across the network.

    So, please also a account  that have permissions on the folder for “Execution Account”.  We can use Reporting Services Configuration Manager to set the Execution Account.

    Thanks,
    Jin Chen


    Jin Chen - MSFT
    Tuesday, December 29, 2009 9:43 AM
    Moderator
  • Hi Jin,

            Many thanks for your answers and sharing the knowledge. I did manage to solve the problem by putting the assembly in GAC. It has been working fine after that. But your answers certainly imparts knowledge.

    Cheers,

    Bhupendra


    It is not the "times of triumph" but the "times of trial" which separate men from boys
    Tuesday, December 29, 2009 9:47 AM
  • Hi Bhupendra,

    I am glad to hear that you have solved the issue.

    If you have any more questions about SQL Server Reporting Services, please feel free to ask in SQL Server Reporting Services forum.

    Best regards,
    Jin Chen
    Jin Chen - MSFT
    Tuesday, December 29, 2009 9:54 AM
    Moderator