By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,647 Members | 1,618 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,647 IT Pros & Developers. It's quick & easy.

app.config for DLL

P: n/a
I am calling a C# method/DLL from Reporting Services. In the DLL, I am
referencing ConfigurationSettings.AppSettings["DBConnectionString"].
This should go in app.config in the caller's folder. This is fine when
the caller is a regular .NET application, but I don't know where to put
the app.config for Reporting Services.

Jul 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
1. During runtime the report is generated under the Report Server host
process so the <appSetting> section in web.config file should work. Try
rendering a report from the Report which has a textbox with the following
expression:
= System.Configuration.Configuration.AppSettings(<yo ur config value>)
Please note that the web.config file already has a configuration section
so you need to add only the <appSettings> element. You should have the same
result when calling this from your DLL since it will be loaded in the RS
application domain.

2. During design time it is a bit trickier. Unfortunately, the current
configuration handler of the Report Designer doesn't seem to recognize
<appSettings>. However, you can render the report in debug mode by hitting
F5. This renders the report under ReportHost.exe. To get the config settings
working, create a ReportHost.exe.config in C:\Program Files\Microsoft SQL
Server\80\Tools\Report Designer and place your configuration section there
(the <configuration> element should be spelled with small "c"), e.g.:
<?xml version="1.0" encoding="utf-8" ?><configuration>
<appSettings>

<add key="serverUrl" value="http://localhost/reportserver" />
</appSettings>
</configuration>

b) To get the Preview tab working you could either check for Nothing and
replace that with a default value, or wrap the ConfigSettings.AppSettings
call to default to some default constant values. Once again, this is only
needed during design time. Your runtime report generation shouldn't need
this hack.

--
Hope this helps.

---------------------------------------------
Teo Lachev, MVP [SQL Server], MCSD, MCT
Author: "Microsoft Reporting Services in Action"
Publisher website: http://www.manning.com/lachev
Buy it from Amazon.com: http://shrinkster.com/eq
Home page and blog: http://www.prologika.com/
---------------------------------------------

"Bucky" <uw********@mail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
I am calling a C# method/DLL from Reporting Services. In the DLL, I am
referencing ConfigurationSettings.AppSettings["DBConnectionString"].
This should go in app.config in the caller's folder. This is fine when
the caller is a regular .NET application, but I don't know where to put
the app.config for Reporting Services.

Jul 21 '05 #2

P: n/a
Just to clarify...by web.config I meant the Report Server web.config file
located in C:\Program Files\Microsoft SQL Server\MSSQL\Reporting
Services\ReportServer if default setup settings have been accepted.

--
Hope this helps.

---------------------------------------------
Teo Lachev, MVP [SQL Server], MCSD, MCT
Author: "Microsoft Reporting Services in Action"
Publisher website: http://www.manning.com/lachev
Buy it from Amazon.com: http://shrinkster.com/eq
Home page and blog: http://www.prologika.com/
---------------------------------------------

"Teo Lachev [MVP]" <te********@nospam.prologika.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
1. During runtime the report is generated under the Report Server host
process so the <appSetting> section in web.config file should work. Try
rendering a report from the Report which has a textbox with the following
expression:
= System.Configuration.Configuration.AppSettings(<yo ur config value>)
Please note that the web.config file already has a configuration section
so you need to add only the <appSettings> element. You should have the
same result when calling this from your DLL since it will be loaded in the
RS application domain.

2. During design time it is a bit trickier. Unfortunately, the current
configuration handler of the Report Designer doesn't seem to recognize
<appSettings>. However, you can render the report in debug mode by hitting
F5. This renders the report under ReportHost.exe. To get the config
settings
working, create a ReportHost.exe.config in C:\Program Files\Microsoft SQL
Server\80\Tools\Report Designer and place your configuration section there
(the <configuration> element should be spelled with small "c"), e.g.:
<?xml version="1.0" encoding="utf-8" ?><configuration>
<appSettings>

<add key="serverUrl" value="http://localhost/reportserver" />
</appSettings>
</configuration>

b) To get the Preview tab working you could either check for Nothing and
replace that with a default value, or wrap the ConfigSettings.AppSettings
call to default to some default constant values. Once again, this is only
needed during design time. Your runtime report generation shouldn't need
this hack.

--
Hope this helps.

---------------------------------------------
Teo Lachev, MVP [SQL Server], MCSD, MCT
Author: "Microsoft Reporting Services in Action"
Publisher website: http://www.manning.com/lachev
Buy it from Amazon.com: http://shrinkster.com/eq
Home page and blog: http://www.prologika.com/
---------------------------------------------

"Bucky" <uw********@mail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
I am calling a C# method/DLL from Reporting Services. In the DLL, I am
referencing ConfigurationSettings.AppSettings["DBConnectionString"].
This should go in app.config in the caller's folder. This is fine when
the caller is a regular .NET application, but I don't know where to put
the app.config for Reporting Services.


Jul 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.