How do I resolve a System.Security.SecurityException with custom code in SSRS?

早过忘川 提交于 2019-11-28 23:29:03
Noorani raza
<system.web>

<trust level="Full"/>

</system.web>

try this in web.config

This is how I was able to solve the issue:

  • strongly sign the custom assembly in question
  • modify the rssrvpolicy.config file to add permissions for the assembly

                        <CodeGroup
                            class="UnionCodeGroup"
                            version="1"
                            PermissionSetName="FullTrust"
                            Name="Test"
                            Description="This code group grants the Test code full trust. ">
                            <IMembershipCondition
                                    class="StrongNameMembershipCondition"
                                    version="1"
                                    PublicKeyBlob="0024000004800000940100000602000000240000575341310004000001000100ab4b135615ca6dfd586aa0c5807b3e07fa7a02b3f376c131e0442607de792a346e64710e82c833b42c672680732f16193ba90b2819a77fa22ac6d41559724b9c253358614c270c651fad5afe9a0f8cbd1e5e79f35e0f04cb3e3b020162ac86f633cf0d205263280e3400d1a5b5781bf6bd12f97917dcdde3c8d03ee61ccba2c0"
                                />
                        </CodeGroup>
    

Side note: here is a great way to get the public key blob of your assembly VS trick for obtaining the public key token and blob of a signed assembly.

Run your service in administrator mode

 <CodeGroup class="FirstMatchCodeGroup" version="1" PermissionSetName="FullTrust">

For me, the solution was changing the above line in the rssrvpolicy.config from "None" to "FullTrust".

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!