Showing posts with label retrieving. Show all posts
Showing posts with label retrieving. Show all posts

Friday, February 17, 2012

Custom assembly : Retrieving data from from configuration file.

Hi all,

my problem is that: I do read informations (e.g. connectionString) from configuration file by one custom assembly.
My environment is RS2005, VS.NET 2005 Prof.Edition, WIN2003 Server SP1, .NET Framework 2.0.50727
The scenario is that:
A text box into my report require a function contained into MyCustom.dll. This code do read information from MyCustom.dll.config.

This file contains:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<connectionStrings>
<add name="IS2009cfg" connectionString="data source=servername\instancename;initial catalog=dbname;user id=xx;password=yy;" />
</connectionStrings>
<appSettings>
<add key="DefaultHeaderLogo" value="This is a test" />
</appSettings>
</configuration>

Using
ConnectionStringSettings conn = ConfigurationManager.ConnectionStrings["IS2009cfg"];
the result is null.

Also using
string defaultHeaderLogo = ConfigurationManager.AppSettings["DefaultHeaderLogo"];
the result is null.

MyCustom.dll and MyCustom.dll.config are located into locations of Report Server and Report Designer, with this Build Events on succesfully build:

rem Copy custom assembly to ReportDesigner location...
copy "...mydeveloplocation...\bin\Debug\MyCustom.dll" "C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\MyCustom.dll"
copy "...mydeveloplocation...\bin\Debug\MyCustom.dll.config" "C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\MyCustom.dll.config"
rem Copy custom assembly to ReportServer location...
copy "...mydeveloplocation...\bin\Debug\MyCustom.dll" "C:\Program Files\Microsoft SQL Server\MSSQL.4\Reporting Services\ReportServer\bin\MyCustom.dll"
copy "...mydeveloplocation...\bin\Debug\MyCustom.dll.config" "C:\Program Files\Microsoft SQL Server\MSSQL.4\Reporting Services\ReportServer\bin\MyCustom.dll.config"

The question is simple: where I do locate configuration file for obtain value during report execution?

Many thank's in advance

Claudio Barca
Turin - Italy

Hi, I have the same problem
Do you have solve it?
Thanks

Custom assembly : Retrieving data from from configuration file.

Hi all,

my problem is that: I do read informations (e.g. connectionString) from configuration file by one custom assembly.
My environment is RS2005, VS.NET 2005 Prof.Edition, WIN2003 Server SP1, .NET Framework 2.0.50727
The scenario is that:
A text box into my report require a function contained into MyCustom.dll. This code do read information from MyCustom.dll.config.

This file contains:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<connectionStrings>
<add name="IS2009cfg" connectionString="data source=servername\instancename;initial catalog=dbname;user id=xx;password=yy;" />
</connectionStrings>
<appSettings>
<add key="DefaultHeaderLogo" value="This is a test" />
</appSettings>
</configuration>

Using
ConnectionStringSettings conn = ConfigurationManager.ConnectionStrings["IS2009cfg"];
the result is null.

Also using
string defaultHeaderLogo = ConfigurationManager.AppSettings["DefaultHeaderLogo"];
the result is null.

MyCustom.dll and MyCustom.dll.config are located into locations of Report Server and Report Designer, with this Build Events on succesfully build:

rem Copy custom assembly to ReportDesigner location...
copy "...mydeveloplocation...\bin\Debug\MyCustom.dll" "C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\MyCustom.dll"
copy "...mydeveloplocation...\bin\Debug\MyCustom.dll.config" "C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\MyCustom.dll.config"
rem Copy custom assembly to ReportServer location...
copy "...mydeveloplocation...\bin\Debug\MyCustom.dll" "C:\Program Files\Microsoft SQL Server\MSSQL.4\Reporting Services\ReportServer\bin\MyCustom.dll"
copy "...mydeveloplocation...\bin\Debug\MyCustom.dll.config" "C:\Program Files\Microsoft SQL Server\MSSQL.4\Reporting Services\ReportServer\bin\MyCustom.dll.config"

The question is simple: where I do locate configuration file for obtain value during report execution?

Many thank's in advance

Claudio Barca
Turin - Italy

Hi, I have the same problem
Do you have solve it?
Thanks

|||I had the same issue and after much debugging I discovered the ConfigurationManager was not reading from MyAssembly.dll.config, but rather it was accessing the machine.config. I added my connection string to the machine.config file and it starting working.

Custom Assembly #Error For Repoting Services 2005

Hi,
I have written an simple class in C# code for retrieving data from SQL 2005,
I could not solve the problem at run time (showed #Error) although I have :-
a) Include the assert statement as below :-
System.Data.SqlClient.SqlClientPermission oPerm = new
System.Data.SqlClient.SqlClientPermission(System.Security.Permissions.PermissionState.Unrestricted);
oPerm.Assert();
b) Adding code group as below :-
<CodeGroup
class="UnionCodeGroup" version="1" PermissionSetName="FullTrust" Name="Copy
of TestCodeGroup" Description="Why didn't
work?"> <IMembershipCondition
class="UrlMembershipCondition" version="1.0.0.0" Url="C:\Program
Files\Microsoft SQL Server\MSSQL.4\Reporting
Services\ReportServer\bin\prj_RptLib.dll" />
</CodeGroup>
I tried the position of the code group, created strong name but still could
not make get the problem solved.
I really appreciate if anyone could help to provide any information or
solution.
Regards,Hi,
Do you deploy to a Windows 2003 Server? Then try to use SQL-Server
Authentication. This worked for us. No idea why Integrated Security only
worked on XP.
Regards,
"chlow" <chlow@.discussions.microsoft.com> schrieb im Newsbeitrag
news:EE2DC3D3-1FCF-4A00-9FBF-585B83651EDD@.microsoft.com...
> Hi,
> I have written an simple class in C# code for retrieving data from SQL
> 2005,
> I could not solve the problem at run time (showed #Error) although I have
> :-
> a) Include the assert statement as below :-
> System.Data.SqlClient.SqlClientPermission oPerm = new
> System.Data.SqlClient.SqlClientPermission(System.Security.Permissions.PermissionState.Unrestricted);
> oPerm.Assert();
> b) Adding code group as below :-
> <CodeGroup
> class="UnionCodeGroup" version="1" PermissionSetName="FullTrust"
> Name="Copy
> of TestCodeGroup" Description="Why didn't
> work?"> <IMembershipCondition
> class="UrlMembershipCondition" version="1.0.0.0" Url="C:\Program
> Files\Microsoft SQL Server\MSSQL.4\Reporting
> Services\ReportServer\bin\prj_RptLib.dll" />
> </CodeGroup>
> I tried the position of the code group, created strong name but still
> could
> not make get the problem solved.
> I really appreciate if anyone could help to provide any information or
> solution.
> Regards,|||Hi Ralph,
Thanks for your assistance. I have tried to compile the code in Visual
Studio 2003 with some minor modifications due to certain assembly not
available in 2003 and it worked, not sure why. By the way, the
authentication that you referred to is the C# code (my class library) where I
used it to connect to SQL server ? If yes, in fact, I tried both SQL and
Window authentication in my code but still encounter the same error.
Thanks,
chlow
"Ralph Watermann" wrote:
> Hi,
>
> Do you deploy to a Windows 2003 Server? Then try to use SQL-Server
> Authentication. This worked for us. No idea why Integrated Security only
> worked on XP.
>
> Regards,
>
>
> "chlow" <chlow@.discussions.microsoft.com> schrieb im Newsbeitrag
> news:EE2DC3D3-1FCF-4A00-9FBF-585B83651EDD@.microsoft.com...
> > Hi,
> >
> > I have written an simple class in C# code for retrieving data from SQL
> > 2005,
> > I could not solve the problem at run time (showed #Error) although I have
> > :-
> >
> > a) Include the assert statement as below :-
> > System.Data.SqlClient.SqlClientPermission oPerm = new
> > System.Data.SqlClient.SqlClientPermission(System.Security.Permissions.PermissionState.Unrestricted);
> > oPerm.Assert();
> >
> > b) Adding code group as below :-
> > <CodeGroup
> > class="UnionCodeGroup" version="1" PermissionSetName="FullTrust"
> > Name="Copy
> > of TestCodeGroup" Description="Why didn't
> > work?"> <IMembershipCondition
> > class="UrlMembershipCondition" version="1.0.0.0" Url="C:\Program
> > Files\Microsoft SQL Server\MSSQL.4\Reporting
> > Services\ReportServer\bin\prj_RptLib.dll" />
> > </CodeGroup>
> >
> > I tried the position of the code group, created strong name but still
> > could
> > not make get the problem solved.
> >
> > I really appreciate if anyone could help to provide any information or
> > solution.
> >
> > Regards,
>
>