Showing posts with label config. Show all posts
Showing posts with label config. Show all posts

Thursday, March 22, 2012

Custom Task: How to access/modify the variables of a package

Hi,

I'm trying to simplify the deployment process of my project. I already had some troubles with the config files but lets say I solved that issue. I'm going to read a flat file and set the variables of my packages from this file. I was thinking to use a Script Task to do that but I will need to copy this task in every package (I have at least 30). So if I want to make some change this will be painful.

Then, I came up with the idea of creating a Custom Task called Config File Task. I'm working on this but I got stuck trying to get the variables from the package that is running my Config File Task.

This is the code I had in the Script Task:

Dim streamReader As New StreamReader(Dts.Variables("ConfigFilePath").Value.ToString)
Dim line As String
Dim lineArray As String()
Dim variableName As String
Dim variableValue As String
Dim readConfigurations As Boolean = False

While (streamReader.Peek() <> -1)
line = streamReader.ReadLine()
If line = "[CONFIGURATIONS]" Then
readConfigurations = True
ElseIf line = "[/CONFIGURATIONS]" Then
readConfigurations = False
Else
If readConfigurations And line <> "" Then
lineArray = line.Split("|".ToCharArray())
variableName = lineArray(0).Trim()
variableValue = lineArray(1).Trim()

If Dts.Variables.Contains(variableName) Then
Dts.Variables(variableName).Value = variableValue
End If
End If
End If
End While
Dts.TaskResult = Dts.Results.Success

All I want to do is set the variables that exists in each package from the config file. In my UI Class (ConfigFileTaskUI.cs) I can have access to the variables via the TaskHost which is passed as an argument of Initialize() method.

Any thoughts? I'd really appreciate some help!

P.S. I've been working on this for 2 days!

I don't have an answer to your question, but have you looked at using package configurations (SSIS > Package Configurations from the BIDS menu)? these can be stored as simple XML files that can be used for the same purpose as what I think you are trying to do here.

Note that BIDS will not save connection string passwords for you - you would have to open the XML file and edit it manually to add these if you are using it for connection strings.

You can use these XML files to store variable values as well as lots of other properties of your package objects. You could write your own code to manipulate the contents of the XML configuration files however you like.

Another option would be to store your values in a database and fetch the values into the variables using SSIS Execute SQL tasks or a similar method.

Maybe you've thought of all this already and ruled it out for some other reason - but based on your post this would seem a much simpler method?

|||Hi Slicktop,

Yes, I tried the XML config file but you cannot have configurations that don't exists in the package. About the SSIS_Configuration table, I thought of this but it's not a good idea for my deployment process. Somehow, I need to get the information from this table and put it in a flat file so I can store it in CVS. Plus, I need to fill this table every time I deploy my packages. I know this is not so difficult but my client don't want to do this.

There is a property in the Package object which disable the warning messages from the configuration file. If I set to True, I don't get an error message when I have just one XML config file with multiple configurations which they may or may not exists in the package to be executed. I don't like doing this because it doesn't seem right.

Thanks for your ideas.|||

What about just reading the flat file using SSIS? You could either load it into a work table and then query it to set variables, or maybe even use a transform to extract the values you need.

When you say "you cannot have configurations that don't exist in the package", what do you mean exactly? Your variable names aren't defined in the package?

|||That's right!. I don't have the same variables in every package. I have a log file per package so in the flat file I have:

log_package_1 = something
log_package_2 = something
log_package_3 = something
conn_db = connection string to db
file_vpn = path to the vpn file

and so on, so in package 1 I only have declared variable log_package_1 but not the rest of the variables of my flat file. Reading the flat file with SSIS could be a possible option but the thing is I have a custom flat file, I mean it's not comma separated and I have some "tags" so I don't think SSIS can read it.

Thanks for the ideas!|||

well obviously I don't know all the details of your situation but it sure seems like you are trying to do this the hard way.

Is there some reason why your custom flat file has to have a "custom" format?

If your goal is to dynamically populate package variables, and the variable names are defined in the package definition, then you can use package configurations to do this. If your goal is to have only a single flat file that contains all variable values across multiple packages, then why not just write these into a standard, machinable format (XML, delimited file, whatever) and then use SSIS to load the file into a DB table. Then from each package, query the table for the variable values needed for that particular package and use the resultset to populate the package variables.

Your table could be generic, with two varchar columns, var_name and var_value.

so, in package 1, you could write an execute SQL task that runs "select var_value from control_table where var_name = 'log_package_1', etc.

If you put a bit of thought into this you could probably make parts of this solution quite generic so that you could write it once and copy/paste the tasks into each package or nest your packages to re-use it. for example, maybe add a "package_name" column to the control table that you could use to query all variables for a package using the same SQL.

sorry, I know I haven't answered your original question (don't know the answer) but thought maybe there is a better (easier) way to do this.

|||Why are you punishing yourself with such a masochistic task?

I mean, why not just use XML Configuration files?|||

Has the original question been answered?

The Task.Execute method is where you will place the code that reads from the file and sets variables. The execute gives you access to the VariableDispenser object as on of the parameters, in much the same way as the TaskUI.Initialize method does, is this not enough?

The Dts.Variables syntax you have used in the Script Task is not applicable, you need to manually control the locking in the variable dispenser. Look at the Lock* methods as documented for the variable dispenser.

|||Hi DarrenSQLIS,

No, the original question haven't been answered yet. I know that Dts.Variables is not applicable in my case when creating a Custom Task. I checked the VariableDispenser object and there are a few methods. For example, the GetVariables(ref Variables variables) but I don't have the collections of variables to pass it as the parameter for this method.

I think I need somehow to tell SSIS which variables are for read-only access and which ones are for read/write. Even so, I would like to know first the variable name and their respective values first. The VariableDispenser object seems useless because I don't know how to get the variables within the package that is executing my Custom Task.

My goal is to know the name of all the User Variables in a package and then set these variables to their respective values that I'm reading from a flat file.

Using XML configuration files is not a solution, I'm not going to set the SuppressConfigurationWarnings property to True in each package. Probably you think I'm trying to do it the hard way but I have to follow some constraints and standards from my client.

Thank you all for your replies.|||

The methods, GetVariables, LockOnForRead or LockOneForWrite all expect a reference parameter of type Variables. This is just the variables collection that is filled with the 'locked' variables that you have asked for, e.g.

Variables variables = null;
variableDispenser.LockOneForRead(this.SnapshotName, ref variables);
snapshotName = variables[0].Value as string;
variables.Unlock();

From what you're saying though you don't know in advance what variables you want to lock, and that is a problem. There is no way to just ask for a list of all variables. I assume your pseudo config item and the variable name match, so at best you can loop through the config items and ask if a variable of that name exists, using the VariableDispenser.Contains method. If found then lock it and do what you want, but you cannot just eneumerate a collection of all variables in the package to find out what is there.

|||Hi DarrenSQLIS,

Yeah, you're right! My pseudo config item and the variable name match so I can loop through the config items and that's what I did. I wasn't understanding the purpose of the GetVariables() method of VariablesDispenser. After I played with it some time I realized it copies the variables from the package that you lock (read-only or r/w) before to the Variables collection that you pass by reference. Then you can access the variables from this collection and set them. What I don't understand completely is how the variables are return to the package or VariablesDispenser. I'm guessing is after you unlock them.

Well, thank you so much for your tips/ideas/suggestions. I finally finished building my Custom Task as I wanted. It's a shame you cannot access all the variables without knowing the name of the variables ahead. In this case I'm assuming that whatever is in the package is also in the config file but my process will fail if the package has a variable that the config file doesn't.sql

Monday, March 19, 2012

Custom Role Provider Everthing working except roles??

Hello Everyone,

I am trying to use a custom role provider, the main purpose so that I don't have to use a database file. My web.config file is posted below. My problem is that I think I have followed all the steps to create a custom role provider using both articles on MSDN and some written by Scott Gu. After Modifying my web.config file I went to the asp.net configuration to test the connection. Users are created in the remote database but roles are being picked up and created in the App_Data folder. Can anyone give me a hint at what I am doing wrong? thanks in advance.

<?

xmlversion="1.0"?>

<!--

Note: As an alternative to hand editing this file you can use the

web admin tool to configure settings for your application. Use

the Website->Asp.Net Configuration option in Visual Studio.

A full list of settings and comments can be found in

machine.config.comments usually located in

\Windows\Microsoft.Net\Framework\v2.x\Config

-->

<

configurationxmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">

<

appSettings/>

<

connectionStrings>

<

addname="MyConnectionString"connectionString="Data Source=10.10.10.10;Database=MyDataBase;Persist Security Info=True;User ID=user;Password=password"providerName="System.Data.SqlClient"/>

</

connectionStrings>

<

system.web>

<!--

Set compilation debug="true" to insert debugging

symbols into the compiled page. Because this

affects performance, set this value to true only

during development.

-->

<

roleManagerenabled="true"/>

<

membershipdefaultProvider="CustomSQLRoleManager">

<

providers>

<

clear/>

<

addname="CustomSQLRoleManager"type="System.Web.Security.SqlMembershipProvider"connectionStringName="MyConnectionString"applicationName="MyAppllicationName"minRequiredPasswordLength="6"minRequiredNonalphanumericCharacters="0"requiresQuestionAndAnswer="false"requiresUniqueEmail="true"/>

</

providers>

</

membership>

<

compilationdebug="true">

<

assemblies>

<

addassembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>

<

addassembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies></compilation>

<!--

The <authentication> section enables configuration

of the security authentication mode used by

ASP.NET to identify an incoming user.

-->

<

authenticationmode="Forms"/>

<!--

The <customErrors> section enables configuration

of what to do if/when an unhandled error occurs

during the execution of a request. Specifically,

it enables developers to configure html error pages

to be displayed in place of a error stack trace.

<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">

<error statusCode="403" redirect="NoAccess.htm" />

<error statusCode="404" redirect="FileNotFound.htm" />

</customErrors>

-->

</

system.web>

</

configuration>

Ok. I figured out what I was missing and bolded the lines that I added to my web.config file

<?

xmlversion="1.0"?>

<!--

Note: As an alternative to hand editing this file you can use the

web admin tool to configure settings for your application. Use

the Website->Asp.Net Configuration option in Visual Studio.

A full list of settings and comments can be found in

machine.config.comments usually located in

\Windows\Microsoft.Net\Framework\v2.x\Config

-->

<

configurationxmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">

<

appSettings/>

<

connectionStrings>

<

removename="LocalSqlServer"/>

<

addname="MyConnectionString"connectionString="Data Source=10.10.10.10;Database=MyDatabase;Persist Security Info=True;User ID=User;Password=password"providerName="System.Data.SqlClient"/>

</

connectionStrings>

<

system.web>

<!--

Set compilation debug="true" to insert debugging

symbols into the compiled page. Because this

affects performance, set this value to true only

during development.

-->

<

roleManagerenabled="true"defaultProvider="CustomSQLRoleManager">

<

providers>

<

clear />

<

addconnectionStringName="MyConnectionString"applicationName="MyApp"name="CustomSQLRoleManager"type="System.Web.Security.SQLRoleProvider" />

</

providers>

</

roleManager>

<

membershipdefaultProvider="SQLRoleManager">

<

providers>

<

clear/>

<

addname="SQLRoleManager"type="System.Web.Security.SqlMembershipProvider"connectionStringName="MyConnectionString"applicationName="MyApp"minRequiredPasswordLength="6"minRequiredNonalphanumericCharacters="0"requiresQuestionAndAnswer="false"requiresUniqueEmail="true"/>

</

providers>

</

membership>

<

compilationdebug="true">

<

assemblies>

<

addassembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>

<

addassembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies></compilation>

<!--

The <authentication> section enables configuration

of the security authentication mode used by

ASP.NET to identify an incoming user.

-->

<

authenticationmode="Forms"/>

<!--

The <customErrors> section enables configuration

of what to do if/when an unhandled error occurs

during the execution of a request. Specifically,

it enables developers to configure html error pages

to be displayed in place of a error stack trace.

<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">

<error statusCode="403" redirect="NoAccess.htm" />

<error statusCode="404" redirect="FileNotFound.htm" />

</customErrors>

-->

</

system.web>

</

configuration>|||

Ok. I figured out what I was missing and bolded the lines that I added to my web.config file

<?

xmlversion="1.0"?>

<!--

Note: As an alternative to hand editing this file you can use the

web admin tool to configure settings for your application. Use

the Website->Asp.Net Configuration option in Visual Studio.

A full list of settings and comments can be found in

machine.config.comments usually located in

\Windows\Microsoft.Net\Framework\v2.x\Config

-->

<

configurationxmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">

<

appSettings/>

<

connectionStrings>

<

removename="LocalSqlServer"/>

<

addname="MyConnectionString"connectionString="Data Source=10.10.10.10;Database=MyDatabase;Persist Security Info=True;User ID=User;Password=password"providerName="System.Data.SqlClient"/>

</

connectionStrings>

<

system.web>

<!--

Set compilation debug="true" to insert debugging

symbols into the compiled page. Because this

affects performance, set this value to true only

during development.

-->

<

roleManagerenabled="true"defaultProvider="CustomSQLRoleManager">

<

providers>

<

clear />

<

addconnectionStringName="MyConnectionString"applicationName="MyApp"name="CustomSQLRoleManager"type="System.Web.Security.SQLRoleProvider" />

</

providers>

</

roleManager>

<

membershipdefaultProvider="SQLRoleManager">

<

providers>

<

clear/>

<

addname="SQLRoleManager"type="System.Web.Security.SqlMembershipProvider"connectionStringName="MyConnectionString"applicationName="MyApp"minRequiredPasswordLength="6"minRequiredNonalphanumericCharacters="0"requiresQuestionAndAnswer="false"requiresUniqueEmail="true"/>

</

providers>

</

membership>

<

compilationdebug="true">

<

assemblies>

<

addassembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>

<

addassembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies></compilation>

<!--

The <authentication> section enables configuration

of the security authentication mode used by

ASP.NET to identify an incoming user.

-->

<

authenticationmode="Forms"/>

<!--

The <customErrors> section enables configuration

of what to do if/when an unhandled error occurs

during the execution of a request. Specifically,

it enables developers to configure html error pages

to be displayed in place of a error stack trace.

<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">

<error statusCode="403" redirect="NoAccess.htm" />

<error statusCode="404" redirect="FileNotFound.htm" />

</customErrors>

-->

</

system.web>

</

configuration>

Saturday, February 25, 2012

Custom Data Extensions and Custom Code: do they require any special settings for internet?

I have configured the config files so that my custom code and data extension
work fine internally. I am having problems getting them to work over the
internet.
Are there any special considerations for this?
ThanksWhat kind of problems?
What do you mean by "work over the internet"?
--
Alex Mineev
Software Design Engineer. Report expressions; Code Access Security; Xml;
SQE.
This posting is provided "AS IS" with no warranties, and confers no rights
"Kevin" <k@.r.com> wrote in message
news:uCmWs0kCFHA.2632@.TK2MSFTNGP09.phx.gbl...
> I have configured the config files so that my custom code and data
extension
> work fine internally. I am having problems getting them to work over the
> internet.
> Are there any special considerations for this?
> Thanks
>|||I have solved the issue. Code Access had to be set for the custom dll.
Thanks
"Alexandre Mineev [MSFT]" <almineev@.microsoft.com> wrote in message
news:eXrtP9tDFHA.392@.TK2MSFTNGP14.phx.gbl...
> What kind of problems?
> What do you mean by "work over the internet"?
> --
> Alex Mineev
> Software Design Engineer. Report expressions; Code Access Security; Xml;
> SQE.
> This posting is provided "AS IS" with no warranties, and confers no rights
> "Kevin" <k@.r.com> wrote in message
> news:uCmWs0kCFHA.2632@.TK2MSFTNGP09.phx.gbl...
>> I have configured the config files so that my custom code and data
> extension
>> work fine internally. I am having problems getting them to work over the
>> internet.
>> Are there any special considerations for this?
>> Thanks
>>
>

Friday, February 24, 2012

Custom code assembly with config file

Hi!

My report has a reference to an assembly of a class library I did. This class library has a config file, classLibrary.dll.config, where I set some parameters, one of these being the "initial path" to the project's folder(for example, project folder is myProject, and you would use the initial path to say it's in c:/projects/tests). When I preview the report everything works fine, but when I publish it I get this error:

Absolute path information is required.

I guess it's not reading the dll.config file, so it can't see the initial path value and concatenate it with the project's folder. I'm supposing this because at first, I forgot to copy the dll.config file to the Microsoft Visual Studio 8/Common7/IDE/PrivateAssemblies folder and I got the same error when trying to preview the report. Copying it to this folder solved the problem. So I think I'm not placing the dll.config file in the rigth folder (I'm copying it to Microsoft SQL Server/MSSQL/ReportServer/bin). If I don't use the config file, I mean, if I put the absolute path directly in the code, everything works, but this is just something I can't do! Can anyone help me?

Thank you!

what happens if you copy config file to reportserver/bin and give 'everyone' read access to it?|||

Hi!

It still can't see the config file... My class library has two classes, Class A uses Class B. Can I use only Class A ddl or should I put both dll files in the rssrvpolicy.config?

Thank you!

|||You should put both|||

Hi!

Still have the problem... When I try to preview the assembly location using Assembly.GetExecutingAssembly().Location, it shows me the rigth path to the dll file. When I try to see it from the published report, I get #Erro on the textbox. Is this write?

Thank you!

|||

Take a look at the logfiles at:
\Program Files\Microsoft SQL Server\MSSQL.2\Reporting Services\LogFiles
Usually they can help you..
Hint:
Stop Reporting Services and WWW-Publishing, delete all old Logfiles, and restart the services. So you can easily find the right logfiles..

|||

Hi!

Thanks for the post, I'll take a look on the log files... But I'm wondering if there is a simpler way to do what I'm trying to do. I'm doing all this because I can't have in my code an absolute path to a xml file configurable by the user. I know that, if it was a web page, I could use Server.MapPath("file.xml") to made it relative to the project path. Can't I do something like this with a Class Library? Or is the config file the only solution?

Thank you!

Sunday, February 19, 2012

Custom Assembly Problems: System.Drawing

Hi,
I built a Custom Assembly to allow me to use external image files in
my report. I deployed the DLL and configured the security policy
config files.
Everything worked great, i got the image coming through to my report
in both Designer Preview mode and when deployed.
I decided to extend the custom assembly to return the dimensions of
the image as well by adding some code that utilizes System.Drawing.DLL
//ok now, lets get the width and height
//FileIOPermission permission = new FileIOPermission
Image myImage = Image.FromFile(pPath);
g_lastHeight = myImage.Height;
g_lastWidth = myImage.Width;
myImage.Dispose();
myImage=null;
After rebuilding and deploying the DLL, my report no longer has any
images when deployed.
However, the images do show up in Designer preview mode, and the DLL
performs correctly returning the image dimensions upon request,
implying a security policy issue'
So my question is what security policy type things do i need to do in
order to utilize System.Drawing.dll in my DLL.
Any help would be greatly appreciated.
Thanks
DerekI believe the correct permission is UIPermission. Please see the following for why it only works in
preview and how to configure the server:
http://msdn.microsoft.com/library/?url=/library/en-us/dnsql2k/html/dngrfCodeAccessSecurityInSQLServer2000ReportingServices.asp?frame=true
Thanks.
Donovan R. Smith
Software Test Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
"Derek W" <derek@.brokerbuilders.com> wrote in message
news:a5df538d.0408161409.6d219516@.posting.google.com...
> Hi,
> I built a Custom Assembly to allow me to use external image files in
> my report. I deployed the DLL and configured the security policy
> config files.
> Everything worked great, i got the image coming through to my report
> in both Designer Preview mode and when deployed.
> I decided to extend the custom assembly to return the dimensions of
> the image as well by adding some code that utilizes System.Drawing.DLL
> //ok now, lets get the width and height
> //FileIOPermission permission = new FileIOPermission
> Image myImage = Image.FromFile(pPath);
> g_lastHeight = myImage.Height;
> g_lastWidth = myImage.Width;
> myImage.Dispose();
> myImage=null;
> After rebuilding and deploying the DLL, my report no longer has any
> images when deployed.
> However, the images do show up in Designer preview mode, and the DLL
> performs correctly returning the image dimensions upon request,
> implying a security policy issue'
> So my question is what security policy type things do i need to do in
> order to utilize System.Drawing.dll in my DLL.
> Any help would be greatly appreciated.
> Thanks
> Derek

custom assembly permissions woes

i have a custom assembly that was working fine, and i've set the basic
permissions needed in the RSReportServer.config file and all was good
however i've just added functionality that uses
System.DirectoryServices and the new code works fine within
visualstudio but i'm quite confused on what i need to do to get it
working on reporting services.
i'll willing to give full permissions to the assembly - at least in
the beginning just to get it running.
KarlKarl,
The exception that gets thrown should describe the failing element (the name
of the secure resource thats broken the security rule)
Hint: take a look at the top of the RSServerPolicy.config file and you'll
see the security permission types - these should provide a clue to which one
you need to use
You'll need to assert this required permission too in your CA and you'll
also need to ensure your CodeGroup (where the CA DLL has been defined) has
the required level defined also.
regards,
- peteZ
"Karl Prosser" <klumsy@.xtra.co.nz> wrote in message
news:7156880c.0410110045.33f32ff5@.posting.google.com...
>i have a custom assembly that was working fine, and i've set the basic
> permissions needed in the RSReportServer.config file and all was good
> however i've just added functionality that uses
> System.DirectoryServices and the new code works fine within
> visualstudio but i'm quite confused on what i need to do to get it
> working on reporting services.
> i'll willing to give full permissions to the assembly - at least in
> the beginning just to get it running.
> Karl|||Hi Karl,
Did you ever find a solution to this problem?
I have made a few similar postings with no luck.
Works fine for System.Data.SqlClient but not with System.DirectoryServices.
Cheers,
Flon
"Karl Prosser" wrote:
> i have a custom assembly that was working fine, and i've set the basic
> permissions needed in the RSReportServer.config file and all was good
> however i've just added functionality that uses
> System.DirectoryServices and the new code works fine within
> visualstudio but i'm quite confused on what i need to do to get it
> working on reporting services.
> i'll willing to give full permissions to the assembly - at least in
> the beginning just to get it running.
> Karl
>

Friday, February 17, 2012

Custom Assembly config file and named instances of Reporting Services

We have a custom assembly that is using a config file. We park the config
file in the instance folder of RS along with the dll. We look in the
registry to find the instance. When there are multiple instances of RS I am
not identifying the correct instance to locate the correct custom assembly
config file. I think what I need to do is use Reflection or Process
libraries to identify the running instance, but haven't been able to figure
this out yet. Anyone using config files for their custom assemblies? We
are using a resource file and could place the config information in there
but that seems wrong. I could use the RS web.config...maybe but don't know
how to do that yet and what the security issues will be.
Thanks for helping,
Steve MunLeeuwI could do two things that I can think of.
1. bad: Pass in the ReportServerURL and loop through the RS instances to
find the one the custom assembly is loaded in and use that to find the
config file.
2. good: Just add the settings to the RS web.config instance. I still need
to test if this will work when running reports from rs.exe utility.
Add the following to web.config:
<appSettings>
<add key="connString" value="connection string" />
</appSettings>
Add the following to custom assembly:
using System.Configuration;
ConfigurationSettings.AppSettings["connString"]
Steve MunLeeuw
"Steve MunLeeuw" <smunson@.clearwire.net> wrote in message
news:e$ys4gs9GHA.4224@.TK2MSFTNGP02.phx.gbl...
> We have a custom assembly that is using a config file. We park the config
> file in the instance folder of RS along with the dll. We look in the
> registry to find the instance. When there are multiple instances of RS I
> am not identifying the correct instance to locate the correct custom
> assembly config file. I think what I need to do is use Reflection or
> Process libraries to identify the running instance, but haven't been able
> to figure this out yet. Anyone using config files for their custom
> assemblies? We are using a resource file and could place the config
> information in there but that seems wrong. I could use the RS
> web.config...maybe but don't know how to do that yet and what the security
> issues will be.
> Thanks for helping,
> Steve MunLeeuw
>|||Ooops, used deprecated method. Here's the updated code:
http://smunson.blogspot.com/
Steve MunLeeuw
"Steve MunLeeuw" <smunson@.clearwire.net> wrote in message
news:%23QsUD%23t9GHA.4408@.TK2MSFTNGP02.phx.gbl...
>I could do two things that I can think of.
> 1. bad: Pass in the ReportServerURL and loop through the RS instances to
> find the one the custom assembly is loaded in and use that to find the
> config file.
> 2. good: Just add the settings to the RS web.config instance. I still
> need to test if this will work when running reports from rs.exe utility.
> Add the following to web.config:
> <appSettings>
> <add key="connString" value="connection string" />
> </appSettings>
> Add the following to custom assembly:
> using System.Configuration;
> ConfigurationSettings.AppSettings["connString"]
>
> Steve MunLeeuw
>
> "Steve MunLeeuw" <smunson@.clearwire.net> wrote in message
> news:e$ys4gs9GHA.4224@.TK2MSFTNGP02.phx.gbl...
>> We have a custom assembly that is using a config file. We park the
>> config file in the instance folder of RS along with the dll. We look in
>> the registry to find the instance. When there are multiple instances of
>> RS I am not identifying the correct instance to locate the correct custom
>> assembly config file. I think what I need to do is use Reflection or
>> Process libraries to identify the running instance, but haven't been able
>> to figure this out yet. Anyone using config files for their custom
>> assemblies? We are using a resource file and could place the config
>> information in there but that seems wrong. I could use the RS
>> web.config...maybe but don't know how to do that yet and what the
>> security issues will be.
>> Thanks for helping,
>> Steve MunLeeuw
>

custom assembly cant read app.config file.

i added an app.config to my custom assembly but when i try
to read keys from it i get Nothing back.
my config file looks like this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="SERVER" value="j4b-web-srv6" />
<add key="DATABASE" value="GUIDEWEBLIVE" />
<add key="USER" value="sa" />
<add key="PASSWORD" value="sqldoor5" />
</appSettings>
<system.diagnostics>
<sources>
<!-- Th
<--snip-->
then i call it like so:
sServer = System.Configuration.ConfigurationManager.AppSettings("SERVER")
the config file is renamed to FundTrackHelper.dll.configHi,
Did you get any error msg when trying to read the config file?
Any resources accessed throught custom assemblie of the report has to be
given proper permission in the assmblie and in the reports server config
policy file. Did you do that before accessing file?
in the assemblie you have to do something like this..
FileIOPermission FIOPermRead = new
FileIOPermission(FileIOPermissionAccess.Read, strPath);
FIOPermRead.Assert();
let me know if this helps
~Bava
"taz" wrote:
> i added an app.config to my custom assembly but when i try
> to read keys from it i get Nothing back.
> my config file looks like this:
> <?xml version="1.0" encoding="utf-8" ?>
> <configuration>
> <appSettings>
> <add key="SERVER" value="j4b-web-srv6" />
> <add key="DATABASE" value="GUIDEWEBLIVE" />
> <add key="USER" value="sa" />
> <add key="PASSWORD" value="sqldoor5" />
> </appSettings>
> <system.diagnostics>
> <sources>
> <!-- Th
> <--snip-->
> then i call it like so:
> sServer = System.Configuration.ConfigurationManager.AppSettings("SERVER")
> the config file is renamed to FundTrackHelper.dll.config
>|||hi,
i didnt get any error msg, it just returns "Nothing".
i did not give it any permissions so i guess thats
what i was missing. i'll give it a try and let u know -
thanks a lot !
t.
"Bava Mani" wrote:
> Hi,
> Did you get any error msg when trying to read the config file?
> Any resources accessed throught custom assemblie of the report has to be
> given proper permission in the assmblie and in the reports server config
> policy file. Did you do that before accessing file?
> in the assemblie you have to do something like this..
> FileIOPermission FIOPermRead = new
> FileIOPermission(FileIOPermissionAccess.Read, strPath);
> FIOPermRead.Assert();
> let me know if this helps
> ~Bava
> "taz" wrote:
> >
> > i added an app.config to my custom assembly but when i try
> > to read keys from it i get Nothing back.
> >
> > my config file looks like this:
> >
> > <?xml version="1.0" encoding="utf-8" ?>
> > <configuration>
> >
> > <appSettings>
> > <add key="SERVER" value="j4b-web-srv6" />
> > <add key="DATABASE" value="GUIDEWEBLIVE" />
> > <add key="USER" value="sa" />
> > <add key="PASSWORD" value="sqldoor5" />
> > </appSettings>
> >
> > <system.diagnostics>
> > <sources>
> > <!-- Th
> >
> > <--snip-->
> >
> > then i call it like so:
> >
> > sServer = System.Configuration.ConfigurationManager.AppSettings("SERVER")
> >
> > the config file is renamed to FundTrackHelper.dll.config
> >

Custom Assembly

Having problems with the <CustomAssemblies> attribute in my config files. It
doesn't exist!?!. I have a couple books for examples, Enterprise and Dev
versions running here onsite. I cannot find this element in the 2 defined
configs that are supposed to have this element. Since they don't seem to
exist, am I supposed to add it? and Where in the config files?. Any ideas
or a point in the right direction. Even the help files say the config files
are supposed to have this element, and to remove the comment. but it doesn't
seem to exist. Help:)
Frustrated Reporter:)Hi Clint,
I've been through rather step learning curve with Custom Assemblies over the
last week and although I'm definately not a guru, I hope to be able to
return some advice in this area - I hope !
OK, I expect the 2 config files are the Report Designer and the RS config
files yes ?
In order to make custom assemblies work, it depends on what they do - this
governs what code security policy directives you need to implment into youe
RS policy config file.
RS will "trust" your custom assemblies to a point (simply static expressions
require no special privelidges) . . . . if however you try and access
protected resources outside your custom assemblies (eg. call a web Service,
get environment vars, read files etc) you'll need to add specific details
and evidence info. into the RS Policy Server PemissionSet and Code group
sections
I can give specific help on these issues if you need more direction.
If you have corrupted (or badly formatted XML in your config files, you may
need to recover from backup (of in worse case just re-install RS)
regards,
- peteZ
"Clint Jennings" <cjennings@.fusionAlliance.com> wrote in message
news:O5hmffGkEHA.2664@.TK2MSFTNGP11.phx.gbl...
> Having problems with the <CustomAssemblies> attribute in my config files.
> It
> doesn't exist!?!. I have a couple books for examples, Enterprise and Dev
> versions running here onsite. I cannot find this element in the 2 defined
> configs that are supposed to have this element. Since they don't seem to
> exist, am I supposed to add it? and Where in the config files?. Any ideas
> or a point in the right direction. Even the help files say the config
> files
> are supposed to have this element, and to remove the comment. but it
> doesn't
> seem to exist. Help:)
> Frustrated Reporter:)
>|||It took a few tries but success. Thanx PeteZ.
"PeteZ" wrote:
> Hi Clint,
> I've been through rather step learning curve with Custom Assemblies over the
> last week and although I'm definately not a guru, I hope to be able to
> return some advice in this area - I hope !
> OK, I expect the 2 config files are the Report Designer and the RS config
> files yes ?
> In order to make custom assemblies work, it depends on what they do - this
> governs what code security policy directives you need to implment into youe
> RS policy config file.
> RS will "trust" your custom assemblies to a point (simply static expressions
> require no special privelidges) . . . . if however you try and access
> protected resources outside your custom assemblies (eg. call a web Service,
> get environment vars, read files etc) you'll need to add specific details
> and evidence info. into the RS Policy Server PemissionSet and Code group
> sections
> I can give specific help on these issues if you need more direction.
> If you have corrupted (or badly formatted XML in your config files, you may
> need to recover from backup (of in worse case just re-install RS)
> regards,
> - peteZ
>
> "Clint Jennings" <cjennings@.fusionAlliance.com> wrote in message
> news:O5hmffGkEHA.2664@.TK2MSFTNGP11.phx.gbl...
> > Having problems with the <CustomAssemblies> attribute in my config files.
> > It
> > doesn't exist!?!. I have a couple books for examples, Enterprise and Dev
> > versions running here onsite. I cannot find this element in the 2 defined
> > configs that are supposed to have this element. Since they don't seem to
> > exist, am I supposed to add it? and Where in the config files?. Any ideas
> > or a point in the right direction. Even the help files say the config
> > files
> > are supposed to have this element, and to remove the comment. but it
> > doesn't
> > seem to exist. Help:)
> >
> > Frustrated Reporter:)
> >
> >
>
>|||peteZ, I an having this same problem. What config file and where should the
<CustomAssemblies> attribute be added?
Thanks
"PeteZ" wrote:
> Hi Clint,
> I've been through rather step learning curve with Custom Assemblies over the
> last week and although I'm definately not a guru, I hope to be able to
> return some advice in this area - I hope !
> OK, I expect the 2 config files are the Report Designer and the RS config
> files yes ?
> In order to make custom assemblies work, it depends on what they do - this
> governs what code security policy directives you need to implment into youe
> RS policy config file.
> RS will "trust" your custom assemblies to a point (simply static expressions
> require no special privelidges) . . . . if however you try and access
> protected resources outside your custom assemblies (eg. call a web Service,
> get environment vars, read files etc) you'll need to add specific details
> and evidence info. into the RS Policy Server PemissionSet and Code group
> sections
> I can give specific help on these issues if you need more direction.
> If you have corrupted (or badly formatted XML in your config files, you may
> need to recover from backup (of in worse case just re-install RS)
> regards,
> - peteZ
>
> "Clint Jennings" <cjennings@.fusionAlliance.com> wrote in message
> news:O5hmffGkEHA.2664@.TK2MSFTNGP11.phx.gbl...
> > Having problems with the <CustomAssemblies> attribute in my config files.
> > It
> > doesn't exist!?!. I have a couple books for examples, Enterprise and Dev
> > versions running here onsite. I cannot find this element in the 2 defined
> > configs that are supposed to have this element. Since they don't seem to
> > exist, am I supposed to add it? and Where in the config files?. Any ideas
> > or a point in the right direction. Even the help files say the config
> > files
> > are supposed to have this element, and to remove the comment. but it
> > doesn't
> > seem to exist. Help:)
> >
> > Frustrated Reporter:)
> >
> >
>
>