Tuesday, March 27, 2012

Embedded Code

Hi all,
I have a report in which I use some embedded code.
The assemblies I use are standard .NET assemblies.
In my PC the rendering of the report goes fine, but when i try to render
this report on another machine, the fields that call the embedded code
(code!some_function) do not render correctly.
Any help would be appreciated,
thnks!
GoncaloYour assembly dll files must be copied to the ReportServer\bin folder of the
report server for your reports to work after being deployed to the server. If
you are previewing from Report Designer, the assembly dll files must be
copied to the 80\Tools\Report Designer folder also.
Charles Kangai, MCDBA, MCT
"Goncalo" wrote:
> Hi all,
> I have a report in which I use some embedded code.
> The assemblies I use are standard .NET assemblies.
> In my PC the rendering of the report goes fine, but when i try to render
> this report on another machine, the fields that call the embedded code
> (code!some_function) do not render correctly.
> Any help would be appreciated,
> thnks!
> Goncalo
>|||Thanks Charles, but I already did that and it still doesn't work.
The dll's I use are System.Data.dll and System.Web.dll.
Could it be that I must set some kind of permissions or perhaps change the
web.config file to add these references?
Thanks in advance,
Gonçalo
"Charles Kangai" wrote:
> Your assembly dll files must be copied to the ReportServer\bin folder of the
> report server for your reports to work after being deployed to the server. If
> you are previewing from Report Designer, the assembly dll files must be
> copied to the 80\Tools\Report Designer folder also.
> Charles Kangai, MCDBA, MCT
> "Goncalo" wrote:
> > Hi all,
> > I have a report in which I use some embedded code.
> > The assemblies I use are standard .NET assemblies.
> >
> > In my PC the rendering of the report goes fine, but when i try to render
> > this report on another machine, the fields that call the embedded code
> > (code!some_function) do not render correctly.
> >
> > Any help would be appreciated,
> > thnks!
> > Goncalo
> >|||If you are using the built-in .NET assembly dll's you do not need to copy the
files. However, you may need to add references to them in your report. Access
the Report Properties screen by right-clicking the report selector and
choosing Properties. On the References tab, add references to any DLLs you
use in your report.
Charles Kangai, MCDBA, MCT
"Goncalo" wrote:
> Thanks Charles, but I already did that and it still doesn't work.
> The dll's I use are System.Data.dll and System.Web.dll.
> Could it be that I must set some kind of permissions or perhaps change the
> web.config file to add these references?
> Thanks in advance,
> Gonçalo
> "Charles Kangai" wrote:
> > Your assembly dll files must be copied to the ReportServer\bin folder of the
> > report server for your reports to work after being deployed to the server. If
> > you are previewing from Report Designer, the assembly dll files must be
> > copied to the 80\Tools\Report Designer folder also.
> >
> > Charles Kangai, MCDBA, MCT
> >
> > "Goncalo" wrote:
> >
> > > Hi all,
> > > I have a report in which I use some embedded code.
> > > The assemblies I use are standard .NET assemblies.
> > >
> > > In my PC the rendering of the report goes fine, but when i try to render
> > > this report on another machine, the fields that call the embedded code
> > > (code!some_function) do not render correctly.
> > >
> > > Any help would be appreciated,
> > > thnks!
> > > Goncalo
> > >|||Thanks once again Charles! I have done that already but it didn't work either.
I know now what is going wrong.
In my custom code I use a connection to a database. When I render the report
with the Report Designer everything goes fine but when I deploy it to the
ReportServer I get an exception:
"System.Security.SecurityException: Request for the permission of type
System.Data.SqlClient.SqlClientPermission, System.Data, Version=1.0.5000.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
at System.Security.CodeAccessSecurityEngine.CheckHelper(PermissionSet
grantedSet, PermissionSet deniedSet, CodeAccessPermission demand,
PermissionToken permToken)
at System.Security.CodeAccessSecurityEngine.Check(PermissionToken
permToken, CodeAccessPermission demand, StackCrawlMark& stackMark, Int32
checkFrames, Int32 unrestrictedOverride)
at System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission
cap, StackCrawlMark& stackMark)
at System.Security.CodeAccessPermission.Demand()
at System.Data.SqlClient.SqlConnectionString.Demand(SqlConnectionString
constr)
at System.Data.SqlClient.SqlConnection.Open()
at CalculosDiversos.CalculosDiversos.cambios(String xMoeda1, String
xMoeda2, Int32 iAno, Int32 iMes) in E:\Projectos\Clientes\Consulado
Angola\Relatorios\Bibliotecas
Auxiliares\CalculosDiversos\CalculosDiversos.vb:line 254"
Must I edit some .config file so that I can get those permissions?
Thanks in advance,
Goncalo
"Charles Kangai" wrote:
> If you are using the built-in .NET assembly dll's you do not need to copy the
> files. However, you may need to add references to them in your report. Access
> the Report Properties screen by right-clicking the report selector and
> choosing Properties. On the References tab, add references to any DLLs you
> use in your report.
> Charles Kangai, MCDBA, MCT
> "Goncalo" wrote:
> > Thanks Charles, but I already did that and it still doesn't work.
> > The dll's I use are System.Data.dll and System.Web.dll.
> > Could it be that I must set some kind of permissions or perhaps change the
> > web.config file to add these references?
> >
> > Thanks in advance,
> > Gonçalo
> >
> > "Charles Kangai" wrote:
> >
> > > Your assembly dll files must be copied to the ReportServer\bin folder of the
> > > report server for your reports to work after being deployed to the server. If
> > > you are previewing from Report Designer, the assembly dll files must be
> > > copied to the 80\Tools\Report Designer folder also.
> > >
> > > Charles Kangai, MCDBA, MCT
> > >
> > > "Goncalo" wrote:
> > >
> > > > Hi all,
> > > > I have a report in which I use some embedded code.
> > > > The assemblies I use are standard .NET assemblies.
> > > >
> > > > In my PC the rendering of the report goes fine, but when i try to render
> > > > this report on another machine, the fields that call the embedded code
> > > > (code!some_function) do not render correctly.
> > > >
> > > > Any help would be appreciated,
> > > > thnks!
> > > > Goncalo
> > > >|||This is a well documented scenario. You are trying to access an external
resource from your code. By default SQLRS does not allow this unless you
configure code access security. Code running on your report server is only
granted Execute permission, by default, which means that only in-memory
computations are allowed. Access to files, databases, URLs, etc. are not
allowed. Please look up the documentation to see how to configure code access
security. You will need to do three things:
1) Modify your code to assert the database access permission.
2) configure the rspreviewpolicy.config file in the Report Designer folder
if you want to test your permissions in the Designer (viewing report using
Debug/Start).
3) configure the rssvrpolicy.config file in the ReportServer folder if you
are going to deploy the report that uses your assembly.
Charles Kangai, MCDBA, MCT
"Goncalo" wrote:
> Thanks once again Charles! I have done that already but it didn't work either.
> I know now what is going wrong.
> In my custom code I use a connection to a database. When I render the report
> with the Report Designer everything goes fine but when I deploy it to the
> ReportServer I get an exception:
> "System.Security.SecurityException: Request for the permission of type
> System.Data.SqlClient.SqlClientPermission, System.Data, Version=1.0.5000.0,
> Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
> at System.Security.CodeAccessSecurityEngine.CheckHelper(PermissionSet
> grantedSet, PermissionSet deniedSet, CodeAccessPermission demand,
> PermissionToken permToken)
> at System.Security.CodeAccessSecurityEngine.Check(PermissionToken
> permToken, CodeAccessPermission demand, StackCrawlMark& stackMark, Int32
> checkFrames, Int32 unrestrictedOverride)
> at System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission
> cap, StackCrawlMark& stackMark)
> at System.Security.CodeAccessPermission.Demand()
> at System.Data.SqlClient.SqlConnectionString.Demand(SqlConnectionString
> constr)
> at System.Data.SqlClient.SqlConnection.Open()
> at CalculosDiversos.CalculosDiversos.cambios(String xMoeda1, String
> xMoeda2, Int32 iAno, Int32 iMes) in E:\Projectos\Clientes\Consulado
> Angola\Relatorios\Bibliotecas
> Auxiliares\CalculosDiversos\CalculosDiversos.vb:line 254"
>
> Must I edit some .config file so that I can get those permissions?
> Thanks in advance,
> Goncalo
>
> "Charles Kangai" wrote:
> > If you are using the built-in .NET assembly dll's you do not need to copy the
> > files. However, you may need to add references to them in your report. Access
> > the Report Properties screen by right-clicking the report selector and
> > choosing Properties. On the References tab, add references to any DLLs you
> > use in your report.
> >
> > Charles Kangai, MCDBA, MCT
> >
> > "Goncalo" wrote:
> >
> > > Thanks Charles, but I already did that and it still doesn't work.
> > > The dll's I use are System.Data.dll and System.Web.dll.
> > > Could it be that I must set some kind of permissions or perhaps change the
> > > web.config file to add these references?
> > >
> > > Thanks in advance,
> > > Gonçalo
> > >
> > > "Charles Kangai" wrote:
> > >
> > > > Your assembly dll files must be copied to the ReportServer\bin folder of the
> > > > report server for your reports to work after being deployed to the server. If
> > > > you are previewing from Report Designer, the assembly dll files must be
> > > > copied to the 80\Tools\Report Designer folder also.
> > > >
> > > > Charles Kangai, MCDBA, MCT
> > > >
> > > > "Goncalo" wrote:
> > > >
> > > > > Hi all,
> > > > > I have a report in which I use some embedded code.
> > > > > The assemblies I use are standard .NET assemblies.
> > > > >
> > > > > In my PC the rendering of the report goes fine, but when i try to render
> > > > > this report on another machine, the fields that call the embedded code
> > > > > (code!some_function) do not render correctly.
> > > > >
> > > > > Any help would be appreciated,
> > > > > thnks!
> > > > > Goncalo
> > > > >|||I have the same issue did you get a resolution to this?
Regards
Toby.
"Goncalo" <Goncalo@.discussions.microsoft.com> wrote in message
news:A1F2CBB5-5B79-4C85-B2BA-A09C13E1109B@.microsoft.com...
> Thanks once again Charles! I have done that already but it didn't work
> either.
> I know now what is going wrong.
> In my custom code I use a connection to a database. When I render the
> report
> with the Report Designer everything goes fine but when I deploy it to the
> ReportServer I get an exception:
> "System.Security.SecurityException: Request for the permission of type
> System.Data.SqlClient.SqlClientPermission, System.Data,
> Version=1.0.5000.0,
> Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
> at System.Security.CodeAccessSecurityEngine.CheckHelper(PermissionSet
> grantedSet, PermissionSet deniedSet, CodeAccessPermission demand,
> PermissionToken permToken)
> at System.Security.CodeAccessSecurityEngine.Check(PermissionToken
> permToken, CodeAccessPermission demand, StackCrawlMark& stackMark, Int32
> checkFrames, Int32 unrestrictedOverride)
> at System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission
> cap, StackCrawlMark& stackMark)
> at System.Security.CodeAccessPermission.Demand()
> at System.Data.SqlClient.SqlConnectionString.Demand(SqlConnectionString
> constr)
> at System.Data.SqlClient.SqlConnection.Open()
> at CalculosDiversos.CalculosDiversos.cambios(String xMoeda1, String
> xMoeda2, Int32 iAno, Int32 iMes) in E:\Projectos\Clientes\Consulado
> Angola\Relatorios\Bibliotecas
> Auxiliares\CalculosDiversos\CalculosDiversos.vb:line 254"
>
> Must I edit some .config file so that I can get those permissions?
> Thanks in advance,
> Goncalo
>
> "Charles Kangai" wrote:
>> If you are using the built-in .NET assembly dll's you do not need to copy
>> the
>> files. However, you may need to add references to them in your report.
>> Access
>> the Report Properties screen by right-clicking the report selector and
>> choosing Properties. On the References tab, add references to any DLLs
>> you
>> use in your report.
>> Charles Kangai, MCDBA, MCT
>> "Goncalo" wrote:
>> > Thanks Charles, but I already did that and it still doesn't work.
>> > The dll's I use are System.Data.dll and System.Web.dll.
>> > Could it be that I must set some kind of permissions or perhaps change
>> > the
>> > web.config file to add these references?
>> >
>> > Thanks in advance,
>> > Gonçalo
>> >
>> > "Charles Kangai" wrote:
>> >
>> > > Your assembly dll files must be copied to the ReportServer\bin folder
>> > > of the
>> > > report server for your reports to work after being deployed to the
>> > > server. If
>> > > you are previewing from Report Designer, the assembly dll files must
>> > > be
>> > > copied to the 80\Tools\Report Designer folder also.
>> > >
>> > > Charles Kangai, MCDBA, MCT
>> > >
>> > > "Goncalo" wrote:
>> > >
>> > > > Hi all,
>> > > > I have a report in which I use some embedded code.
>> > > > The assemblies I use are standard .NET assemblies.
>> > > >
>> > > > In my PC the rendering of the report goes fine, but when i try to
>> > > > render
>> > > > this report on another machine, the fields that call the embedded
>> > > > code
>> > > > (code!some_function) do not render correctly.
>> > > >
>> > > > Any help would be appreciated,
>> > > > thnks!
>> > > > Goncalo
>> > > >|||@.charles kangai: can you also explain how this must be done? Your kind of
answer is the one i like most!!! Especially it includes wrong hints as in
your answer!
In my case the following helps:
The .net code must be modified by write a line direct above your function
like this:
<PermissionSet(SecurityAction.Assert, Unrestricted:=True)> _
Public Function InitOracleConn() As Boolean
...
End Function
The rssrvpolicy.config and RSReportServer.config must be modified. You need
something more as described in the documentation. I did it in the following
way:
I added this code to RSReportServer.config before the </Configuration> Tag:
---
<CustomAssemblies>
<Default>
<PermissionSet class="System.Security.PermissionSet">
<IPermission
class="System.Security.Permissions.SecurityPermission"
version="1"
Flags="Execution"
/>
</PermissionSet>
</Default>
</CustomAssemblies>
<CustomAssemblies>
<Assembly Name="AIDAReportTranslator, Version=1.0.1.2, Culture=neutral,
PublicKeyToken=null">
<PermissionSet class="System.Security.PermissionSet">
<IPermission
class="System.Security.Permissions.SecurityPermission"
version="1"
Flags="Execution, Assertion"
/>
</PermissionSet>
</Assembly>
<Default>
<PermissionSet class="System.Security.PermissionSet">
<IPermission
class="System.Security.Permissions.SecurityPermission"
version="1"
Flags="Execution"
/>
</PermissionSet>
</Default>
</CustomAssemblies>
---
In the rssrvpolicy.config I added this code before the
</NamedPermissionSets> Tag
---
<PermissionSet class="NamedPermissionSet"
version="1"
Name="MyNewFilePermissionSet"
Description="A special permission set that grants read access to my file.">
<IPermission class="Microsoft.Data.Odbc.OdbcPermission"
version="1"
Flags="Assertion, Execution"/>
</PermissionSet>
--
and I added the following code group after the last code group:
---
<CodeGroup class="UnionCodeGroup"
version="1"
PermissionSetName="FullTrust"
Name="MyNewCodeGroup"
Description="A special code group for my custom assembly.">
<IMembershipCondition class="UrlMembershipCondition"
version="1"
Url="C:\Programme\Microsoft SQL Server\MSSQL\Reporting
Services\ReportServer\bin\AIDAReportTranslator.dll"/>
</CodeGroup>
---
The file rspreviewpolicy.config must not be modified ! ! !
Ths
"Charles Kangai" wrote:
> This is a well documented scenario. You are trying to access an external
> resource from your code. By default SQLRS does not allow this unless you
> configure code access security. Code running on your report server is only
> granted Execute permission, by default, which means that only in-memory
> computations are allowed. Access to files, databases, URLs, etc. are not
> allowed. Please look up the documentation to see how to configure code access
> security. You will need to do three things:
> 1) Modify your code to assert the database access permission.
> 2) configure the rspreviewpolicy.config file in the Report Designer folder
> if you want to test your permissions in the Designer (viewing report using
> Debug/Start).
> 3) configure the rssvrpolicy.config file in the ReportServer folder if you
> are going to deploy the report that uses your assembly.
> Charles Kangai, MCDBA, MCT
> "Goncalo" wrote:
> > Thanks once again Charles! I have done that already but it didn't work either.
> > I know now what is going wrong.
> > In my custom code I use a connection to a database. When I render the report
> > with the Report Designer everything goes fine but when I deploy it to the
> > ReportServer I get an exception:
> >
> > "System.Security.SecurityException: Request for the permission of type
> > System.Data.SqlClient.SqlClientPermission, System.Data, Version=1.0.5000.0,
> > Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
> > at System.Security.CodeAccessSecurityEngine.CheckHelper(PermissionSet
> > grantedSet, PermissionSet deniedSet, CodeAccessPermission demand,
> > PermissionToken permToken)
> > at System.Security.CodeAccessSecurityEngine.Check(PermissionToken
> > permToken, CodeAccessPermission demand, StackCrawlMark& stackMark, Int32
> > checkFrames, Int32 unrestrictedOverride)
> > at System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission
> > cap, StackCrawlMark& stackMark)
> > at System.Security.CodeAccessPermission.Demand()
> > at System.Data.SqlClient.SqlConnectionString.Demand(SqlConnectionString
> > constr)
> > at System.Data.SqlClient.SqlConnection.Open()
> > at CalculosDiversos.CalculosDiversos.cambios(String xMoeda1, String
> > xMoeda2, Int32 iAno, Int32 iMes) in E:\Projectos\Clientes\Consulado
> > Angola\Relatorios\Bibliotecas
> > Auxiliares\CalculosDiversos\CalculosDiversos.vb:line 254"
> >
> >
> > Must I edit some .config file so that I can get those permissions?
> >
> > Thanks in advance,
> > Goncalo
> >
> >
> > "Charles Kangai" wrote:
> >
> > > If you are using the built-in .NET assembly dll's you do not need to copy the
> > > files. However, you may need to add references to them in your report. Access
> > > the Report Properties screen by right-clicking the report selector and
> > > choosing Properties. On the References tab, add references to any DLLs you
> > > use in your report.
> > >
> > > Charles Kangai, MCDBA, MCT
> > >
> > > "Goncalo" wrote:
> > >
> > > > Thanks Charles, but I already did that and it still doesn't work.
> > > > The dll's I use are System.Data.dll and System.Web.dll.
> > > > Could it be that I must set some kind of permissions or perhaps change the
> > > > web.config file to add these references?
> > > >
> > > > Thanks in advance,
> > > > Gonçalo
> > > >
> > > > "Charles Kangai" wrote:
> > > >
> > > > > Your assembly dll files must be copied to the ReportServer\bin folder of the
> > > > > report server for your reports to work after being deployed to the server. If
> > > > > you are previewing from Report Designer, the assembly dll files must be
> > > > > copied to the 80\Tools\Report Designer folder also.
> > > > >
> > > > > Charles Kangai, MCDBA, MCT
> > > > >
> > > > > "Goncalo" wrote:
> > > > >
> > > > > > Hi all,
> > > > > > I have a report in which I use some embedded code.
> > > > > > The assemblies I use are standard .NET assemblies.
> > > > > >
> > > > > > In my PC the rendering of the report goes fine, but when i try to render
> > > > > > this report on another machine, the fields that call the embedded code
> > > > > > (code!some_function) do not render correctly.
> > > > > >
> > > > > > Any help would be appreciated,
> > > > > > thnks!
> > > > > > Goncalo
> > > > > >

No comments:

Post a Comment