Store Custom Assembly In A Subdirectory Of /bin Folder?
Feb 13, 2008
Good morning all,
Due to "security considerations", the company I am currently working with does not want me deploying custom assemblies into
Microsoft SQL ServerMSSQL.3Reporting ServicesReportServerin.
They have created a subdirectory:
Microsoft SQL ServerMSSQL.3Reporting ServicesReportServerinmySubDirectoryName
Unfortunately, I can't get my report to see the dll when it's in the subdirectory. Is there any way to do this?
I'm trying to do something rather weird, but I really need it. I'm trying to launch a SSIS package from a report
I built a custom assembly with one method that loads a package from file and then executes it. The assembly works fine.
I added the custom assembly to the report properties, instantiated the class in the assembly (the method is not static), called the method from the report (a textbox renders the string return value from the method).
I added the
Code Snippet[assembly: System.Security.AllowPartiallyTrustedCallers] attribute to the AssemblyInfo.cs file
Created the strong name for the assembly.
Got the PublicKeyBlob with ILDASM, used it to add a new CodeGroup with the "StrongNameMembershipCondition" in the policy configuration files of ReportDesigner (RSPreviewPolicy.config), ReportServer (rssrvpolicy.config) and ReportManager (rsmgrpolicy.config).
Copied the dll in the bin folders of ReportServer and Visual Studio PrivateAssemblies.
I keep getting the awfull #Error message on the report when viewing it from ReportManager or ReportServer (in preview mode in VisualStudio all is well because security is not applied to user code).
I tried debugging: - created a solution with two subprojects, one is the report, the other one is the assembly - marked the report as the Startup Item I get a SecurityException in debug and debuglocal modes when I try to instantiate a SSIS package.
Code SnippetPackage = new Package();
While digging in the exception call stack, it turns out I lack a permission for accessing unmanaged code (the source assembly of the exception is mscorlib). Also in the ouput window, while starting debugging i see a lot of SystemArgument exceptions in mscorlib.
I am perfectly aware that in order to be able to launch a SSIS package from code I referenced Microsoft.SqlServer.DtsRuntimeWrap.dll, so in desperation I added another CodeGroup in the aforementioned config files for this dll (StrongNameMembershipCondition) and copied the assembly in the deployment folders.
1: I would really like to know how to get the whole thing working. I find rather strange that even though I set the FullTrust
PermissionSet for my assembly (and the Microsoft.SqlServer.DtsRuntimeWrap assembly) I keep getting security exceptions.
While exploring the web for help I saw I need to assert all individual permissions for every restricted resource I'm accessing in the custom assembly, problem is I don't know exactly which ones I'm accessing and, being new to .NET security, I don't know how.
Surely I need to assert a file IO permission to load the package from file, a sqlclientpermission if I am accessing SqlServer in the package, and perhaps a unmanagedcode permission, given the the exception I described earlier (perhaps the Microsoft.SqlServer.DtsRuntimeWrap assembly is not managed code or is accessing some other unmanaged assembly).
Again, I wouldn't know how.
...and last
2: I tried modifying the assembly to only load a string from a file.. I had some problems with security but I got it working once, but I haven't figured out how exactly 'cause when fiddling around to understand things, I lost the working configuration. Really stupid, I know.... While testing this version of the assembly I followed an advice I found on some blog and restarted IIS and Reporting Services system service..
Is this always necessary after modifying the assembly source ? Do I need to restart every time both IIS AND Reporting Services
I would really appreciate every bit of help or advice anyone has to offer.
I need some help please. Yesterday I get the answer that I had to use an assembly if I would like to use a function as global. Right now I€™m very desperate because my VS didn€™t recognize my DLL. I get the error: "Could not load file or assembly .....The system cannot find the file specified." After red the threads I tried to use gacutil.exe to add my assembly to the cache. This action fails with the error:€? Failure adding Assembly to cache. Attempt to install an assembly without a strong name.€? After that I tried to build a strong name through the follow execute: Sn €“Vr ClassLibrary.dll. This action fails too. I get the follow Error description: €œdll does not represent a strongly named assembly€?.
What made me wrong? Is there an easier workaround? Have someone a good Idea could help me?
I was wanting to get some data through a custom assemly. I can successfully return a primitive data type such as a string and put it in a textbox, but I really need to return more data, and possibly bind it to a Table.
For example, maybe I could return from the call a Dataset and bind it as a DataSource which then can be bound to a Table, or maybe a array of string.
Is this possible? If so, are there any good examples that you know of?
I am trying to integrat a custom assembly into a ssis-package. I copy the assembly into the framwork folder (v2.0.50727) add the reference, use the assembly everything fine. When I try to debug I get a message stating that the assembly name, version .... cannot be found. I tried to do that with signing and without - not difference.
When I run my report from report manager, I get the following error message
Failed to load expression host assembly. Details: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
My report uses a custom assembly. I have already done the following
1. copied the assembly in the "reportserverin" and the "common 7privateassemblies" area 2. Made the following entry in the rssrvpolicy.config
I have developed a custom assembly to render a signature from an array of bytes in an SSRS Image control. The assembly works perfectly in the designer. It is strong-named and has the AllowPartiallyTrustedCallers attribute applied to it; I have deployed the assembly to the "%SQL SERVER%MSSQL.3Reporting ServicesReportServerin" folder; given it fulltrust permissions in the rssrvpolcy.config file; made sure that the NTFS file security is correct; and the assembly just doesn't appear to be called. The assembly doesn't execute when I use the "F5" popup preview mode on my development machine, either.
I don't get any error messages in the report, I just don't get any image output, either. The rest of the report elements render correctly. Of course, the SSRS log files are useless. Enabling the Verbose trace switch doesn't yield any useful information, I don't think, except that in the lines pertaining to running my signature-enabled report there are no mentions of even attempting to use my custom assembly.
I have attempted to enable object access auditing (both success and failure) to determine if my assembly is even being accessed by SSRS and there are no audit messages in the Security Event log.
Can anyone offer any other troubleshooting suggestions?
I have build a vb.net class that uses the AxMetadataServiceClient (MS Dynamics Axapta model store) this class works like expected in .net app.When I try to create this assembly in sql it fails with this error
Msg 10300, Level 16, State 2, Line 6
Assembly 'System.EnterpriseServices' references assembly 'System.EnterpriseServices, version=4.0.0.0, culture=neutral, publickeytoken= b03f5f7f11 d50a3 a.', which is not present in the current database.
SQL Server attempted to locate and automatically load the referenced assembly from the same location where referring assembly came from, but that operation has failed (reason: version, culture or public key mismatch). Please load the referenced assembly into the current database and retry your request.can't create the assembly since it references it self and can't find it self ?
I have a custom assembly that I'm trying to use with my resport in Reporting Services in SQL Server 2008. I keep consistently getting a "Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data,Version=2.0.0.0, Culture=neutral,PublicKeyToken=b77a5c561934e089' failed" error. Even in preview mode.
- I added <Assembly: AllowPartiallyTrustedCallers()> attribute to the assembly - I'm asserting the permission in the routine that is doing the database call with the follwing lines: Dim permission As SqlClient.SqlClientPermission = New SqlClient.SqlClientPermission(PermissionState.Unrestricted) permission.Assert() - I went in .net 2.0 Framework configuration and made the assembly fully trusted - I added the approprtiate codegroup to the rssrvpolicy.config file - I tried the same assembly on another PC running SQL server reporting services 2005, its working just fine.
I did the reportViewer.LocalReport.AddTrustedCodeModuleInCurrentAppDomain (€?PackageCode, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6d1c15bd232054a1€?); part in my code.
I also added the [assembly: System.Security.AllowPartiallyTrustedCallers] too.
I published the assembly to GAC.
I added the dll as reference in rdlc file. And I get this error when I try to enter this code under a textbox
GetRequired is underlined with a red error line which says "unrecognized identifer" when I mouseover onto it. And when I run the report I get #Error in that textbox.
I dont have a reporting server.I get the data from a dataset. What to do now ? Thanks for help.
Is it possible to have a Reporting Services dataset be returned from a custom assembly? I need to produce data for a graph that is not easily queried from the database and I am already familiar with using a custom assembly in an RS report.
What I would like to do is have a method that fills a dataset and returns it to the report for processing. Is this possible?
OK. I created a few functions in a Public Class called SSRSFunctions. I built it and deployed it to my desktop. What do I do now? Can it be included as standard functions in the function list within SSRS? Do I add a reference to the Class at the solution level? At the report level? If all I do is add a reference at the report level, I may as well add the functions to each report's code window, which is what I have been doing. I'd at least like to add a single reference to my solution if I can't get it added to the function list.
I have created a custom assembly and referenced it and the program builds successfully. When I try to run the report in design mode, it will not render, it throws an exception when it tries to create a PDF. When I remove the assembly, the reports work well. So I'm not sure what it is that I'm doing wrong - does anyone have any suggestions?
namespace Calculations
{
public class calcPercentage
{
public static decimal Percentage(decimal decValueOne, decimal decValueTwo)
I referenced the assembly and added it to C:Program FilesMicrosoft Visual Studio 8Common7IDEPrivateAssemblies and I still get that error message so I do not know what the problem is.
The line where the exception occurs happens here:
byte[] bytes = MyReport.rvOutput.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamids, out warnings);
Thanks so much for you help! If you have any suggestions about my next error...i'm all ears!
I have a custom assembly that i'm trying to get tied into my report. the problem is when i try to call it i get the error that the class is not defined
I have the class in the references tab and the class name and instance name both have a name.
here's the error I'm getting
Error 1 [rsCompilerErrorInClassInstanceDeclaration] Error in class instance declaration for class Assembly_1: [BC30002] Type '[ClassName]' is not defined. [Project folder][reportname].rdl 0 0
I designed dll file to get data from sql server, i am calling the dll from ssrs 2005 in preview , everything is ok but after deploying and put the dll file in C:Program FilesMicrosoft SQL ServerMSSQL.3Reporting ServicesReportServerin and add this to rssrvpolicy.config
<CodeGroup class="SqlClientPermission" version="1" Name="MySecurityExtensionCodeGroup" Description="Code Group for Don's test security extension" PermissionSetName="FullTrust"> <IMembershipCondition class="UrlMembershipCondition" version="1" Url="C:Program FilesMicrosoft SQL ServerMSSQLReporting ServicesReportServerinMyAssembly.dll" /> </CodeGroup>
The main problem I am currently facing is that I do not have the following directory to place the DLL file: C:Program FilesMicrosoft SQL Server80ToolsReport Designer. It is the "Report Designer" part that is missing. I tried adding it, but that didn't work.
I'm having a terrible time trying to figure out how to do this, does anyone have experience?
My code works fine in the report viewer, but all I get from the deployment is #Error symbols. I've added my custom dll file to the config file and gave it full trust, as well as the URL of the web service I'm calling. I've even modified the rest of the codegroups within the file to FullTrust just in case.
I've also added the [assembly: AllowPartiallyTrustedCallers] to the AssemblyInfo class, and [WebPermission(SecurityAction.Assert)] to the constructor of my custom assembly no avail.
I'm at a complete loss now as to why my deployment cannot run this code. As far as debugging goes, Visual Studio is not located on the reporting server, nor is it an option to have it put there. I've been able to run the code with the web service lines commented out, but as soon as I put even the webservice.Credentials = CredentialCache.DefaultCredentials in I'm greeted with the nice and calming #Error.
We have a custom assembly that worked fine with SSRS 2000. Now that we have upgraded to SQL 2005 we get an "Access is denied" error when attempting to deploy reports that reference this assembly. I could swear that when we first attempted it it worked. We decided to make a minor change to the assembly code and that's when the problem started, even though I've since reverted back to the original code to make certain that the minor change wasn't the issue. The assembly is in the proper folder - C:Program FilesMicrosoft SQL ServerMSSQL.2Reporting ServicesReportServerin - and the reports are referencing the current version. I've searched high and low on the web for an answer but have found nothing even remotely helpful. All this code does is return a string...it's not doing anything that should require any additional security; and even then I doubt if there would be a problem when deploying.
The full text of the error is: Error while loading code module: €˜Reporting, Version=1.0.2778.12272, Culture=neutral, PublicKeyToken=null€™. Details: Could not load file or assembly 'Reporting, Version=1.0.2778.12272, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Access is denied.
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.
We use reporting services to report on our SQL 2005.
I wanted to have a function that translates a filter (parameter) in one RDL from IDs to Names to be able to show a summary of what the user selected when he executed the report.
Instead of writing this function in the .Code, I said great, lets use custom assemblies.
PROBLEM: I see examples on how to enable a function in such dll access to DB, but they all hardcode the connection string in the vb code. that seems useless to me. Each customer will have different server name, I need to get the connection string from the sme (shared data source) used in the catalog's folder. just like the RDl is using it. how do I do that?
I am having a problem with a client's MS SQL Server 2005. When doing a restore, SQL will not allow me to restore to the database mdf and ldf files outside the SQL root folder (C:Program FilesMicrosoft SQL Server). I want the data and log files to be on a separate disk with plenty of disk space. When I created the database, SQL allowed me to create the mdf and ldf files in the E:Data SQL ServerData folder. But when I perform the restore SQL reverts to the C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLData folder. I am specifically redirecting the mdf and ldf files to the custom folder by clicking on the button (...) to change the folder.
I have tried creating a new SQL Server instance and uninstalling and reinstalling SQL Server to no avail.
How can I force the restore task to restore my database to the custom data folder location?
I have a custom assembly that uses a config file to obtain database connection settings. This dll is then used by my sql report. I have added refrerenced to all the required dll's in my report and added the required code groups to all the necessary files. I have also placed my app.config file in C:Program FilesMicrosoft SQL ServerMSSQL.3Reporting ServicesReportServer and C:Program FilesMicrosoft Visual Studio 8Common7IDEPrivateAssemblies However when I actually run the report in the designer (vs2005) I am receiving Null reference exceptions when my code tries to read my config file because it is reading the machine.config file and not my app.config file. If I hard code my connection string everything works fine.
Can anyone tell me why the machine.config file would be referenced instead of my app.config file and how I can stop it from doing this?
I have an assembly, call it A1, that I've deployed to a SQL Server 2005 database. I can use the managed stored procedures from A1 in SQL Server no problem.
In A1 there is a bit of code which uses the Assembly.Load() method, so load another assembly and use instances of class found in that external assembly. However, when I run the managed stored proc in A1 that uses Assembly.Load() I get the error:
Could not load file or assembly 'A1, Version=1.0.0.0, Culture=neutral,PublicKeyToken='????' or one of its dependencies. The system cannot find the file specified.
(note: for security I've changed some of the above line).
I re-built the project, re-deployed it and ran the code in SQL Server - it worked. I could create an instance of a System.Data.DataSet for example. So why can't I load my own custom assembly? My assembly does have a strong name and it's installed in the GAC. I wrote a console app to try and Assembly.Load() my custom assembly and that worked fine (it was also running on the same server as the SQL Server).
So it's defiantely the SQL Server that can't 'see' my customer assembly. What do I need to do this assembly so that SQL Server will allow me to Assembly.Load it, just as it can with System.Data?
I have several developers working on different systems but same database; these developers make Store Procedures and all utilize these SP€™s; at the moment our SP list grows and keeps about 200 + SP's, whereas I expect a lot more to come.
Now I want to organize the SP''s under certain folders; example by the System and underneath by User name so that traceability of the work can be easy as well as organization of the SP's will be achieved.
I cannot find any way how to customize the Store Procedure node; and create folder underneath.
I know the filter option helps for searching the SP's but we also have remote users who are working somewhere away from us; so I want to get their work only by filtering the folder of these user name and also sometimes I need to know who made these SP's so that that developer can fix or alter the procedures.
We may do this using security instead of dbo, the developer who is creating the procedure will carry his name; but this needs tight security and we are in the phase of testing and lot of changes occurs on daily basis which requires little loose security till we pass this phase.
Any Idea or suggestions to make it viewable and accessible and copy the work of the specific users right away; rather than searching his Sp's, with the coordination of the user or with the maintained documentation.
I am using the QRCode4CS class [URL] .... to generate QR codes.
I can use the following code to successfully return a bitmap image to a picturebox in a Windows Form Application.
public class CreateQRCodeClass { public static Image CreateQRCodeImage(string inputString) { QRCode4CS.QRCode qrcode = new QRCode4CS.QRCode(new QRCode4CS.Options(inputString)); qrcode.Make(); [Code] ....
In trying to adapt the same code (below) to display a QR code in an SSRS report I get the error "There is an error on line 1 of custom code: [BC30311] Value of type 'System.Drawing.Image' cannot be converted to '1-dimensional array of Byte.'
Here is the custom code I am using.
Public Function QRCode(ByVal RetailerId As String) as Byte() Return QRCode4CSCreateQRCode.CreateQRCodeClass.CreateQRCodeImage(RetailerId) End Function
Here is the revised custom assembly.
public class CreateQRCodeClass { public static byte[] CreateQRCodeImage(string inputString) { QRCode4CS.QRCode qrcode = new QRCode4CS.QRCode(new QRCode4CS.Options(inputString)); qrcode.Make(); Image canvas = new Bitmap(86, 86);
[Code] ....
What data type can I successfully return to SSRS to display the image?
.NET Permissions Error in Reporting Services when not using a custom assembly: I need help resolving a permissions error I€™m taking in a SQL RS 2005 report. I have a report that that is includes the following code fragment in Report Properties -> Code: Function rtf2text(ByVal rtf As String) As String Dim rtfcontrol As New System.Windows.Forms.RichTextBox Try rtfcontrol.Rtf = rtf Return rtfcontrol.Text Catch ex as Exception Return ex.Message End Try End Function I reference the .NET System.Windows.Forms DLL under Report Properties -> References -> References, Assembly Name (heading): System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 I have a text box with the following expression: =code.rtf2text(First(Fields!EndingQuoteComment.Value, "QuoteHeader")) And I€™ve verified, by removing the code.rtf2text command that is populated with the following: { tf1ansiansicpg1252deff0deflang1033{fonttbl{f0fromanfprq2fcharset0 Times New Roman;}{f1fnilfcharset0 Arial;}} viewkind4uc1pardif0fs32 ** Ending Quote Comments **par 0i0f1fs17par } When I run the preview in Visual Studio is correctly strips the RTF and displays just €œ** Ending Quote Comments **€?. When I €˜RUN€™ locally or deploy to a SQL RS 2005 Server and run the report I take the following error: Request for the permission of type 'System.Security.Permissions.UIPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. I€™ve tried everything that I can think of on the server to make this work. I finally put together a Win 2003 box with SQL 2005, IIS, and RS 2005 running on it in a virtual machine to be 100% sure I had a standard clean install and deployed the report and I€™m getting the same error. Below I€™ve included a basic standalone RDL file that demonstrates my issue. I get the error referenced above when I deploy the RDL below. Any ideas or suggestions are greatly appreciated?
<?xml version="1.0" encoding="utf-8"?> <Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner"> <BottomMargin>0.25in</BottomMargin> <RightMargin>0.25in</RightMargin> <PageWidth>7.75in</PageWidth> <rdrawGrid>true</rdrawGrid> <InteractiveWidth>7.75in</InteractiveWidth> <rdnapToGrid>true</rdnapToGrid> <Body> <ReportItems> <Textbox Name="textbox21"> <Left>0.25in</Left> <Top>0.25in</Top> <rdefaultName>textbox21</rdefaultName> <Width>6.375in</Width> <Style> <PaddingLeft>2pt</PaddingLeft> <PaddingBottom>2pt</PaddingBottom> <FontSize>7.5pt</FontSize> <PaddingRight>2pt</PaddingRight> <PaddingTop>2pt</PaddingTop> </Style> <CanGrow>true</CanGrow> <Height>1.375in</Height> <Value>=code.rtf2text("{ tf1ansiansicpg1252deff0deflang1033{fonttbl{f0fromanfprq2fcharset0 Times New Roman;}{f1fnilfcharset0 Arial;}} viewkind4uc1pardif0fs32 ** Ending Quote Comments **par 0i0f1fs17par } ")</Value> </Textbox> </ReportItems> <Height>5.25in</Height> </Body> <rd:ReportID>8804486c-882f-493c-8dfb-b2f778a24b21</rd:ReportID> <LeftMargin>0.25in</LeftMargin> <CodeModules> <CodeModule>System.Windows.Forms, Version=2.0.50727.42, Culture=neutral, PublicKeyToken=b77a5c561934e089</CodeModule> </CodeModules> <Code>Function rtf2text(ByVal rtf As String) As String Dim rtfcontrol As New System.Windows.Forms.RichTextBox Try rtfcontrol.Rtf = rtf Return rtfcontrol.Text Catch ex as Exception Return ex.Message End Try End Function </Code> <Width>7.25in</Width> <InteractiveHeight>10in</InteractiveHeight> <Language>en-US</Language> <TopMargin>0.25in</TopMargin> <PageHeight>10in</PageHeight> </Report>
I am workin on a website for me and my friend. I want to host it at a hosting company. In asp.net 2.0 projects are build with the App_data folder, which can stores data source such as a SQL Server 2005 database. But when i want to host the site at a hosting company, will the database goed into this folder?
As SQL Server 2016 category is not created so I am posting this query in SQL Server 2014 window.
I have enabled Query Store in SQL Server 2016 using ALTER DATABASE and later tried with Properties of Database too. But I am not able to see the Query Store subfolder under database.