Thursday, March 22, 2012
AppSettings with Report Designer?
It works fine on the Report Server (where I put them in web.config), but I
would like it to work in Visual Studio as well.
I have developed an Data Extension Provider to get data from a Business
tier, instead of directly from a database. The Business tier calls a Data
tier, which needs the connectionstring from appsettings. (I cannot change
this behaviour.)
Regards MaranI solved it.
Put the appsettings in Visual Studio's "devenv.exe.config" and they are read
by the IDE and can be used in Report Designer by the Data Extension.
**********************
"Maran" wrote:
> Where do I put appsettings for Report Designer?
> It works fine on the Report Server (where I put them in web.config), but I
> would like it to work in Visual Studio as well.
> I have developed an Data Extension Provider to get data from a Business
> tier, instead of directly from a database. The Business tier calls a Data
> tier, which needs the connectionstring from appsettings. (I cannot change
> this behaviour.)
> Regards Maran|||A couple of thoughts:
1. Create your own App.config file, or any anyfile.anyfile - place your
config setting there.
Embed that file as a part of assembly.
next -
in your app:
Assembly asm....;
Stream stream = null;
string manifest = null;
foreach(string tmp in asm.GetManifestResourceNames())
{
if(tmp.IndexOf("App.config")>0)
{
manifest = tmp;
break;
}
}
....
stream = asm.GetManifestResourceStream(manifest);
XmlDocument configXml = new XmlDocument();
configXmlReader = new XmlTextReader(stream);
configXml.Load(configXmlReader);
XmlNodeList configNodes = configXml.GetElementsByTagName("appSettings");
....
and so on
2. machine.config is always available.
Oleg Yevteyev,
San Diego, CA
It is OK to contact me with a contracting opportunity.
"myfirstname"001atgmaildotcom.
Replace "myfirstname" with Oleg.
--
"Maran" <Maran@.discussions.microsoft.com> wrote in message
news:13D0CA98-7A7F-4023-B617-2917DC2B0AA3@.microsoft.com...
> Where do I put appsettings for Report Designer?
> It works fine on the Report Server (where I put them in web.config), but I
> would like it to work in Visual Studio as well.
> I have developed an Data Extension Provider to get data from a Business
> tier, instead of directly from a database. The Business tier calls a Data
> tier, which needs the connectionstring from appsettings. (I cannot change
> this behaviour.)
> Regards Maransql
appSettings from web.config cannot be referenced in emailed report subscription
Server Software:
SQL Server 2000 (all sp's up to date)
SSRS 2000 (all sp's up to date)
We have an error when a report subscription is sent via email.
Our report definitions reference a key in the web.config file so that we can have a single location to reference our department's name in all reports. Our department name changes frequently as our company is bought and sold and it is difficult to manually update 700+ reports.
In report designer we have a text field with the following value expression:
=System.Configuration.ConfigurationSettings.appSettings("Department").ToString()
Our web.config looks like this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
....extra settings truncated for brevity...
<appSettings>
<add key="Department" value="Report created by: Corporate Reporting and Analysis" />
</appSettings>
</configuration>
The reports work perfectly in every aspect accept when they are schedules to be emailed. When the email recipient receives the email (not matter what format, mhtl, pdf, etc...) the department string value is replaced with: #Error
Is this a bug with the report schedule and deilvery component? ..or is there a permission problem when accessing: System.Configuration.ConfigurationSettings.appSettings("Department").ToString() ?
Any help would be greatly appreciated.
Thank you ![]()
Well, I believe I solved the issue:
The report scheduling service is located in another folder:
C:\Program Files\Microsoft SQL Server\MSSQL\Reporting Services\ReportServer\bin\ReportingServicesService.exe
...and its configuration file is called:
ReportingServicesService.exe.config
All we had to do was modify this config file to match our web.config appSettings and "Presto!" it worked.
<configuration>
....extra settings truncated for brevity...
<appSettings>
<add key="Department" value="Report created by: Corporate Reporting and Analysis" />
</appSettings>
</configuration>
Also, remember to restart the "ReportServer" service after updating the ReportingServicesService.exe.config file in order to immediately reset the changes.
![]()
Monday, February 13, 2012
app.config for DLL
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.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(<your 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_badgers@.mail.com> wrote in message
news:1103320212.226556.252030@.f14g2000cwb.googlegroups.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.
>|||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]" <teo.lachev@.nospam.prologika.com> wrote in message
news:%23wqOlKK5EHA.3728@.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(<your 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_badgers@.mail.com> wrote in message
> news:1103320212.226556.252030@.f14g2000cwb.googlegroups.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.
>