Request for the permission of type System.Security | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Request for the permission of type System.Security

Hi,<br />I can’t get permissions to read a file inside a custom code assembly.<br />Calling functions that doesn’t access a file works fine.<br /><br />I have followed the instructions in under <br />"Deploying a Custom Assembly" in the online documentation. I have also alterd the <br />Machine.config file to run the report manager as user SYSTEM but I still get the following error<br />from FileIOPermission.Assert():<br /><br />Source: mscorlib<br />Message: Request for the permission of type System.Security.Permissions.SecurityPermission, mscorlib, <br /> Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.<br />Stacktrace: <br />at System.Security.CodeAccessSecurityEngine.CheckHelper(PermissionSet grantedSet, PermissionSet deniedSet, CodeAccessPermission demand, PermissionToken permToken)<br />at System.Security.CodeAccessSecurityEngine.CheckNReturnSO(PermissionToken permToken, CodeAccessPermission demand, StackCrawlMark& stackMark, Int32 unrestrictedOverride, Int32 create)<br />at System.Security.CodeAccessSecurityEngine.Assert(CodeAccessPermission cap, StackCrawlMark& stackMark)<br />at System.Security.CodeAccessPermission.Assert()<br />at StenaRSCustomCode.CustomCode.GetString(String ID, String CountryCode)<br /><br />The code I’m running is as follows:<br /><br /> Public Shared Function GetString(ByVal ID As String)<br /> Try<br /> If xdoc Is Nothing Then<br /> Dim permission As New FileIOPermission(FileIOPermissionAccess.Read, "C:TempResource.xml")<br /> permission.Assert()<br /> xdoc = New XPathDocument("C:TempResource.xml")<br /> nav = xdoc.CreateNavigator()<br /> End If<br /><br /> ………<br /><br /> Catch ex As Exception<br /> Return FormatExeceptionOutput(ex)<br /> End Try<br /> End Function<br /><br />In the reporting service config files:<br /><br />&lt;CustomAssemblies&gt;<br />&lt;Assembly Name="CustomCode, Version=1.0.1502.15960, Culture=neutral, PublicKeyToken=null"&gt;<br />&lt<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ermissionSet class="System.Security.PermissionSet"&gt;<br />&lt;IPermission class="System.Security.Permissions.SecurityPermission" version="1" Flags="Execution, Assertion"/&gt;<br />&lt;IPermission class="System.Security.Permissions.FileIOPermission" version="1" Read="C:TempResource.xml"/&gt;<br />&lt;/PermissionSet&gt;<br />&lt;/Assembly&gt;<br />&lt;Default&gt;<br />&lt<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ermissionSet class="System.Security.PermissionSet"&gt;<br />&lt;IPermission class="System.Security.Permissions.SecurityPermission" version="1" Flags="Execution"/&gt;<br />&lt;/PermissionSet&gt;<br />&lt;/Default&gt;<br />&lt;/CustomAssemblies&gt;<br /><br /><br /><br />The one that can help me out is a Hero!<br />Regards<br />-Janne Hasslöf
Hi, We have been having the same problem with populating image fields. We are pulling binary data from a custom assembly (which calls an http request (webClient), to feed a decrypted image) to the image tag in the report, and although it works in Preview Mode in the Report Designer, once deployed, the image does not appear (red X). Since the documentation is very lapse, it is difficult to solve. It definitely is a security configuration problem, whether a bug, or difficult setup, it is truly frustrating. Sorry I don’t have an answer, but just know, there are others out there that share your pain.
]]>