Saturday, February 25, 2012
Assert Permission - ISSUE.
I am using a .net dll in my RDL, I have done all the steps to implement the
custom assembly in the report.
--
Message posted via http://www.sqlmonster.comLook at this thread, you have to get Reporting Services trust your DLL.
http://groups.google.de/groups?hl=de&lr=&threadm=OAxg3EQRFHA.4028%40tk2msftngp13.phx.gbl&rnum=1&prev=/groups%3Fq%3Dreporting%2Bservices%2Bassembly%2Bgac%26hl%3Dde%26lr%3D%26scoring%3Dd%26selm%3DOAxg3EQRFHA.4028%2540tk2msftngp13.phx.gbl%26rnum%3D1
HTH, Jens Suessmeyer.
--
http://www.sqlserver2005.de
--
"BALAJI KRISHNAN via SQLMonster.com" <forum@.nospam.SQLMonster.com> schrieb
im Newsbeitrag news:25b6837f5aaf4a7589ef4ac1bd3cd615@.SQLMonster.com...
> Hi All,
> I am using a .net dll in my RDL, I have done all the steps to implement
> the
> custom assembly in the report.
> --
> Message posted via http://www.sqlmonster.com|||Sorry hit the Post Message button... Remaining Message...
I have done all the steps...
Step 1) Copying the dll to the C:\Program Files\Microsoft SQL Server\MSSQL\
Reporting Services\ReportServer\bin\
and
C:\Program Files\Microsoft SQL Server\80\Tools\Report Designer\ - Folders
Step 2) Create Permission Set and Code Group and changing the
rssrvpolicy.config file...
See my Permission Set and Code Group added to the file
<PermissionSet class="NamedPermissionSet"
version="1"
Name="CCPermissionSet">
<IPermission class="SecurityPermission"
version="1"
Flags="Assertion, Execution"/>
</PermissionSet>
<CodeGroup class="UnionCodeGroup"
version="1"
PermissionSetName="CCPermissionSet"
Name="CCCodeGroup"
Description="">
<IMembershipCondition class="UrlMembershipCondition"
version="1"
Url="file://C:/Program
Files/Microsoft SQL Server/MSSQL/Reporting
Services/ReportServer/bin/CreditCardDecrypt.dll"/>
</CodeGroup>
Step 3) Refering the dll in the RDL (Properties - Reference - map dll)
Step 4) This is the Important step...Where I am missing...I need to give
the Assert permission to my code..I dont know what Assert Permission I need
to give for my dll...(As we give for SqlClientPermission...)
See my dll code...
public static string DecryptCardInfo(string cc,string subjectName,string
storeName)
{
string sCreditCard = "";
try
{
SecurityPermission secPerm = new SecurityPermission
(PermissionState.Unrestricted);
secPerm.Assert();
WSEX509.X509CertificateStore.StoreLocation location =WSEX509.X509CertificateStore.StoreLocation.CurrentUser;
WSEX509.X509CertificateStore.StoreProvider provider =WSEX509.X509CertificateStore.StoreProvider.System;
WSEX509.X509CertificateStore store = new WSEX509.X509CertificateStore
(provider, location, storeName);
bool fopen = store.OpenRead();
if(fopen)
{
WSEX509.X509CertificateCollection certs =store.FindCertificateBySubjectString(subjectName);
if (certs.Count > 0)
{
WSEX509.X509Certificate cer = certs[0];
WSECRY.RSACryptoServiceProvider rsaCsp =(WSECRY.RSACryptoServiceProvider)cer.Key;
byte[] cipherData = Convert.FromBase64String(cc);
byte[] plainData = rsaCsp.Decrypt(cipherData, false);
sCreditCard = Encoding.UTF8.GetString(plainData);
}
}
if (store != null)
store.Close();
return sCreditCard;
//return cc;
}
catch(Exception ex)
{
return ex.ToString();
}
}
}
I am in Need your help Immediately..because I am stuck with this for the
past days..and have no clue for this...
If you need any more information please send a note I can give u
immediately...
Thanks in advance...
balaji.
--
Message posted via http://www.sqlmonster.com|||Try to place you DLL in the GAC to identify wheter it is a security problem.
"BALAJI KRISHNAN via SQLMonster.com" <forum@.SQLMonster.com> schrieb im
Newsbeitrag news:7f6dadd296e74d5a9a51a62bac995613@.SQLMonster.com...
> Sorry hit the Post Message button... Remaining Message...
> I have done all the steps...
> Step 1) Copying the dll to the C:\Program Files\Microsoft SQL
> Server\MSSQL\
> Reporting Services\ReportServer\bin\
> and
> C:\Program Files\Microsoft SQL Server\80\Tools\Report Designer\ - Folders
> Step 2) Create Permission Set and Code Group and changing the
> rssrvpolicy.config file...
> See my Permission Set and Code Group added to the file
> <PermissionSet class="NamedPermissionSet"
> version="1"
> Name="CCPermissionSet">
> <IPermission class="SecurityPermission"
> version="1"
> Flags="Assertion, Execution"/>
> </PermissionSet>
> <CodeGroup class="UnionCodeGroup"
> version="1"
> PermissionSetName="CCPermissionSet"
> Name="CCCodeGroup"
> Description="">
> <IMembershipCondition class="UrlMembershipCondition"
> version="1"
> Url="file://C:/Program
> Files/Microsoft SQL Server/MSSQL/Reporting
> Services/ReportServer/bin/CreditCardDecrypt.dll"/>
> </CodeGroup>
>
> Step 3) Refering the dll in the RDL (Properties - Reference - map dll)
> Step 4) This is the Important step...Where I am missing...I need to give
> the Assert permission to my code..I dont know what Assert Permission I
> need
> to give for my dll...(As we give for SqlClientPermission...)
>
> See my dll code...
> public static string DecryptCardInfo(string cc,string subjectName,string
> storeName)
> {
> string sCreditCard = "";
> try
> {
> SecurityPermission secPerm = new SecurityPermission
> (PermissionState.Unrestricted);
> secPerm.Assert();
> WSEX509.X509CertificateStore.StoreLocation location => WSEX509.X509CertificateStore.StoreLocation.CurrentUser;
> WSEX509.X509CertificateStore.StoreProvider provider => WSEX509.X509CertificateStore.StoreProvider.System;
> WSEX509.X509CertificateStore store = new WSEX509.X509CertificateStore
> (provider, location, storeName);
> bool fopen = store.OpenRead();
> if(fopen)
> {
> WSEX509.X509CertificateCollection certs => store.FindCertificateBySubjectString(subjectName);
> if (certs.Count > 0)
> {
> WSEX509.X509Certificate cer = certs[0];
> WSECRY.RSACryptoServiceProvider rsaCsp => (WSECRY.RSACryptoServiceProvider)cer.Key;
> byte[] cipherData = Convert.FromBase64String(cc);
> byte[] plainData = rsaCsp.Decrypt(cipherData, false);
> sCreditCard = Encoding.UTF8.GetString(plainData);
> }
> }
> if (store != null)
> store.Close();
> return sCreditCard;
> //return cc;
> }
> catch(Exception ex)
> {
> return ex.ToString();
> }
> }
> }
>
> I am in Need your help Immediately..because I am stuck with this for the
> past days..and have no clue for this...
> If you need any more information please send a note I can give u
> immediately...
> Thanks in advance...
> balaji.
> --
> Message posted via http://www.sqlmonster.com|||Hi Jens,
I have placed the dll in the GAC sucessfully.
But still I got #Error...
Balaji
--
Message posted via http://www.sqlmonster.com|||CAN MICROSOFT FOLKS HELP ON THIS....
STILL FACING THE ISSSUE..
THANKS IN ADVANCE
BALAJI
--
Message posted via http://www.sqlmonster.com|||Hi Balaji,
Is your problem is solve of acessing .net dll in reporting service.
I am also having the same problem where my .Net dll reads the config file to
get another file URL which has stored another file URL and using this new URL
(XML file) i am accessing the result through XMldocument and returing the
result back. But the security issue is the main issue which i am not able to
solve. If you can help me out i'll be helpful to you.
Thanks
Jasvinder
"BALAJI KRISHNAN via SQLMonster.com" wrote:
> Hi All,
> I am using a .net dll in my RDL, I have done all the steps to implement the
> custom assembly in the report.
> --
> Message posted via http://www.sqlmonster.com
>
Assembly: returning "Globals!ReportName" but letting RS see it as code, not text?
I'm trying to make a reusable header function. In it, there is the report name and a couple other bits of info. The problem is making RS use the real report name
If I return "Globals!ReportName" in an assembly function, then call that function, I get that exact text - but what I really want is the report name. I understand what it's doing, but how to I trick it:
Is there some way to make RS aware of the fact that this is meant to be seen as something it needs to evaluate rather than just displaying the actual text?
How about passing the report name to your function as a parameter and then return the name in the return value?|||that might be an option.
It's very similar to what i have in place - just appending the report name to the return value.
|||You probably tried this, but would it work to set a variable = Globals!ReportName.Value and then concatenate the variable with your other strings?|||If you mean in the .net assembly, I just tried it and no luck, but thanks. It seems any text returned is taken to be literal, not code. I even tried something like {Globals!ReportName} - hoping to get lucky, but didn't.
Assembly.Load can't load my custom assembly from the GAC.
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).
So I changed the Assembly.Load() to use
System.Data,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089
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?
Thanks
Jas.
Hi Jas,
In order you load your assembly using Assembly.Load, the assembly already has to be loaded into your database using CREATE ASSEMBLY. SqlClr will only load assemblies directly from the gac that are on the list of supported framework assemblies available here: http://msdn2.microsoft.com/en-us/library/ms403279.aspx. All the assemblies on that list (including System.Data) can be accessed by any assembly in your database, but all other assemblies must be loaded using CREATE ASSEMBLY first.
Steven
Assembly ReportingServicesWebServer problem
From the service manager the report service is running, but i get the following error on http://localhost/ReportServer/
Server Error in '/ReportServer' Application.
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.Parser Error Message: Could not load file or assembly 'ReportingServicesWebServer, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. Access is denied.
Source Error:
Line 27: <assemblies>Line 28: <clear />
Line 29: <add assembly="ReportingServicesWebServer" />
Line 30: </assemblies>
Line 31: </compilation>
Source File: C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer\web.config Line: 29
Assembly Load Trace: The following information can be helpful to determine why the assembly 'ReportingServicesWebServer' could not be loaded.
=== Pre-bind state information ===LOG: User = Unknown
LOG: DisplayName = ReportingServicesWebServer
(Partial)
LOG: Appbase = file:///C:/Program Files/Microsoft SQL Server/MSSQL.3/Reporting Services/ReportServer/
LOG: Initial PrivatePath = C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer\web.config
LOG: Using host configuration file: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet.config
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/reportserver/b7e1529c/70d36ced/ReportingServicesWebServer.DLL.
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/reportserver/b7e1529c/70d36ced/ReportingServicesWebServer/ReportingServicesWebServer.DLL.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft SQL Server/MSSQL.3/Reporting Services/ReportServer/bin/ReportingServicesWebServer.DLL.
LOG: Using application configuration file: C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer\web.config
LOG: Using host configuration file: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet.config
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: ReportingServicesWebServer, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91
ERR: Failed to complete setup of assembly (hr = 0x80070005). Probing terminated.
Hi!
I'm having the same problem, can someone help me?
Thank you!
|||I have the same problem ,can someone help me..|||xian_ve
xian_ve,
Can you verify the version SQL reporting services is .NET version 2.0, and that your application pool for reporting service is using "Network" logon?
Ham
|||That is so on my computer.
What is the solution?
Assembly ReportingServicesWebServer problem
From the service manager the report service is running, but i get the following error on http://localhost/ReportServer/
Server Error in '/ReportServer' Application.
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.Parser Error Message: Could not load file or assembly 'ReportingServicesWebServer, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. Access is denied.
Source Error:
Line 27: <assemblies>Line 28: <clear />
Line 29: <add assembly="ReportingServicesWebServer" />
Line 30: </assemblies>
Line 31: </compilation>
Source File: C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer\web.config Line: 29
Assembly Load Trace: The following information can be helpful to determine why the assembly 'ReportingServicesWebServer' could not be loaded.
=== Pre-bind state information ===LOG: User = Unknown
LOG: DisplayName = ReportingServicesWebServer
(Partial)
LOG: Appbase = file:///C:/Program Files/Microsoft SQL Server/MSSQL.3/Reporting Services/ReportServer/
LOG: Initial PrivatePath = C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer\web.config
LOG: Using host configuration file: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet.config
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/reportserver/b7e1529c/70d36ced/ReportingServicesWebServer.DLL.
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/reportserver/b7e1529c/70d36ced/ReportingServicesWebServer/ReportingServicesWebServer.DLL.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft SQL Server/MSSQL.3/Reporting Services/ReportServer/bin/ReportingServicesWebServer.DLL.
LOG: Using application configuration file: C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer\web.config
LOG: Using host configuration file: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet.config
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: ReportingServicesWebServer, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91
ERR: Failed to complete setup of assembly (hr = 0x80070005). Probing terminated.
Hi!
I'm having the same problem, can someone help me?
Thank you!
|||I have the same problem ,can someone help me..|||xian_ve
xian_ve,
Can you verify the version SQL reporting services is .NET version 2.0, and that your application pool for reporting service is using "Network" logon?
Ham
|||That is so on my computer.
What is the solution?
|||I also have d same problem..can anybody tell me how to fix it?????Assembly ReportingServicesWebServer problem
From the service manager the report service is running, but i get the following error on http://localhost/ReportServer/
Server Error in '/ReportServer' Application.
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.Parser Error Message: Could not load file or assembly 'ReportingServicesWebServer, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. Access is denied.
Source Error:
Line 27: <assemblies>Line 28: <clear />
Line 29: <add assembly="ReportingServicesWebServer" />
Line 30: </assemblies>
Line 31: </compilation>
Source File: C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer\web.config Line: 29
Assembly Load Trace: The following information can be helpful to determine why the assembly 'ReportingServicesWebServer' could not be loaded.
=== Pre-bind state information ===LOG: User = Unknown
LOG: DisplayName = ReportingServicesWebServer
(Partial)
LOG: Appbase = file:///C:/Program Files/Microsoft SQL Server/MSSQL.3/Reporting Services/ReportServer/
LOG: Initial PrivatePath = C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer\web.config
LOG: Using host configuration file: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet.config
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/reportserver/b7e1529c/70d36ced/ReportingServicesWebServer.DLL.
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/reportserver/b7e1529c/70d36ced/ReportingServicesWebServer/ReportingServicesWebServer.DLL.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft SQL Server/MSSQL.3/Reporting Services/ReportServer/bin/ReportingServicesWebServer.DLL.
LOG: Using application configuration file: C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer\web.config
LOG: Using host configuration file: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet.config
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: ReportingServicesWebServer, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91
ERR: Failed to complete setup of assembly (hr = 0x80070005). Probing terminated.
Hi!
I'm having the same problem, can someone help me?
Thank you!
|||I have the same problem ,can someone help me..|||xian_ve
xian_ve,
Can you verify the version SQL reporting services is .NET version 2.0, and that your application pool for reporting service is using "Network" logon?
Ham
|||That is so on my computer.
What is the solution?
Assembly ReportingServicesWebServer problem
From the service manager the report service is running, but i get the following error on http://localhost/ReportServer/
Server Error in '/ReportServer' Application.
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.Parser Error Message: Could not load file or assembly 'ReportingServicesWebServer, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. Access is denied.
Source Error:
Line 27: <assemblies>Line 28: <clear />
Line 29: <add assembly="ReportingServicesWebServer" />
Line 30: </assemblies>
Line 31: </compilation>
Source File: C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer\web.config Line: 29
Assembly Load Trace: The following information can be helpful to determine why the assembly 'ReportingServicesWebServer' could not be loaded.
=== Pre-bind state information ===LOG: User = Unknown
LOG: DisplayName = ReportingServicesWebServer
(Partial)
LOG: Appbase = file:///C:/Program Files/Microsoft SQL Server/MSSQL.3/Reporting Services/ReportServer/
LOG: Initial PrivatePath = C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer\web.config
LOG: Using host configuration file: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet.config
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/reportserver/b7e1529c/70d36ced/ReportingServicesWebServer.DLL.
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/reportserver/b7e1529c/70d36ced/ReportingServicesWebServer/ReportingServicesWebServer.DLL.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft SQL Server/MSSQL.3/Reporting Services/ReportServer/bin/ReportingServicesWebServer.DLL.
LOG: Using application configuration file: C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer\web.config
LOG: Using host configuration file: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet.config
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: ReportingServicesWebServer, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91
ERR: Failed to complete setup of assembly (hr = 0x80070005). Probing terminated.
Hi!
I'm having the same problem, can someone help me?
Thank you!
|||I have the same problem ,can someone help me..|||xian_ve
xian_ve,
Can you verify the version SQL reporting services is .NET version 2.0, and that your application pool for reporting service is using "Network" logon?
Ham
|||That is so on my computer.
What is the solution?
|||I had a similar error, and it was some problems in c:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer\rssrvpolicy.config, so check that that one looks correct.
Assembly permissions for accessing db
it has to access a db and without permissions I could not distribute
it...
Can somebody explain it in a breath, please?This article gives a great overview of permissions.
http://www.codeproject.com/dotnet/CustomAssemblies.asp
I wish I had found this before I figured it out for myself.
Craig
"Tur" <cenci.cristiano@.gmail.com> wrote in message
news:1142245992.537105.156310@.j33g2000cwa.googlegroups.com...
> Hi there, I need to know how to set permissions for my assembly, since
> it has to access a db and without permissions I could not distribute
> it...
> Can somebody explain it in a breath, please?
>
Assembly not found in SQL Catalog for VSS
I'm getting this error..
Assembly
'microsoft.visualstudio.sourcesafe.interop, version=5.2.0.0,
culture=neutral, publickeytoken=b03f5f7f11d50a3a.' was not found in the
SQL catalog.
I added reference to VSS dll by opening the project file in notepad, as I couldn't right-click and do an add reference.
Here's the code...
using System;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using Microsoft.SqlServer.Server;
using Microsoft.VisualStudio.SourceSafe.Interop;
public partial class StoredProcedures
{
[Microsoft.SqlServer.Server.SqlProcedure]
public static void PrintToday()
{
try
{
//'— The SourceSafe INI file.
string iniVssPath = "C:/CLRVSS";
//'— The SourceSafe User ID/Password.
string cVSSUserName = "Admin";
string cVSSPassword = "";
VSSDatabaseClass vssLib = null;
vssLib = new VSSDatabaseClass();
vssLib.Open(iniVssPath, cVSSUserName, cVSSPassword);
VSSItem VSS_Item = vssLib.get_VSSItem("$/Test", false);
VSS_Item.Destroy();
SqlPipe p;
p = SqlContext.Pipe;
p.Send("success");
}
catch
{
SqlPipe p;
p = SqlContext.Pipe;
p.Send("error");
}
}
};
from BOL 2005 (April), CREATE ASSEMBLY (Transact-SQL):
Assembly Validation
SQL Server performs checks on the assembly binaries uploaded by the CREATE ASSEMBLY statement to guarantee the following:
The assembly binary is well formed with valid metadata and code segments, and the code segments have valid Microsoft Intermediate language (MSIL) instructions.
The set of system assemblies it references is one of the following supported assemblies in SQL Server: Microsoft.Visualbasic.dll, Mscorlib.dll, System.Data.dll, System.dll, System.Xml.dll, Microsoft.Visualc.dll, Custommarshallers.dll, System.Security.dll, System.Web.Services.dll, and System.Data.SqlXml.dll. Other system assemblies can be referenced, but they must be explicitly registered in the database.
For assemblies created by using SAFE or EXTERNAL ACCESS permission sets:
The assembly code should be type-safe. Type safety is established by running the common language runtime verifier against the assembly.
The assembly should not contain any static data members in its classes unless they are marked as read-only.
The classes in the assembly cannot contain finalizer methods.
The classes or methods of the assembly should be annotated only with allowed code attributes. For more information, see Custom Attributes for CLR Routines.
|||
Visual Studio does not automatically register all references. That is the reason you are not allowed to add arbitrary references to your SQL Server project. You can add references to only supported .NET framework assemblies or assemblies that are already registered in the database.
What you need to do in this case - Register the assembly you want to refer in the database and then add a reference to it.
Thanks,
-Vineet.
Assembly name for SSIS built-in UITypeEditors?
Assembly MyAssembly was not found in the SQL catalog of database MyDB
I’m trying to register my CLR UDF in SQL 2005 using this code
CREATE FUNCTION GetSomething() RETURNS INT
AS EXTERNAL NAME MyAssembly.MyFunction.MyMethod
When I run it against my DB I get this error:
Assembly MyAssembly was not found in the SQL catalog of database MyDB
I’ve successfully registered my custom assembly in the DB (I see it under Assemblies folder), and I’ve set CRL Enabled to 1 in my DB.
What am I doing wrong?
Thanks in advance
A couple of things:1. make sure that the CREATE FUNCTION call is actually executed in the database where MyAssembly is located.
2. Make sure that you spell the name correctly of the assembly
if both of those are OK:
1. then check that you do not have any namespaces in the class name. For example, VB injects a namespace into the assembly, so the class name would be [namespace.classname].
2. make sure that the classname and method name are capitalize correctly - they are case sensitive.
Niels
|||I have same problem and I do deployment using Visual Studio .NET 2005 final release, it is as nightmare to see these outstanding bug free products ...
Assembly MyAssembly was not found in the SQL catalog of database MyDB
I’m trying to register my CLR UDF in SQL 2005 using this code
CREATE FUNCTION GetSomething() RETURNS INT
AS EXTERNAL NAME MyAssembly.MyFunction.MyMethod
When I run it against my DB I get this error:
Assembly MyAssembly was not found in the SQL catalog of database MyDB
I’ve successfully registered my custom assembly in the DB (I see it under Assemblies folder), and I’ve set CRL Enabled to 1 in my DB.
What am I doing wrong?
Thanks in advance
A couple of things:1. make sure that the CREATE FUNCTION call is actually executed in the database where MyAssembly is located.
2. Make sure that you spell the name correctly of the assembly
if both of those are OK:
1. then check that you do not have any namespaces in the class name. For example, VB injects a namespace into the assembly, so the class name would be [namespace.classname].
2. make sure that the classname and method name are capitalize correctly - they are case sensitive.
Niels
|||I have same problem and I do deployment using Visual Studio .NET 2005 final release, it is as nightmare to see these outstanding bug free products ...
assembly for stored procedure
I was playing around with the CLR in writing assemblies for the sql server 2005 stored procedure. I guess the example i found was for the beta version
This line is from the beta but no longer works. Any ideas what will fix this. There is no longer GetCommand property.
SqlCommand cmd =SqlContext.GetCommand();
Example
publicpartialclassStoredProcedures{[Microsoft.SqlServer.Server.SqlProcedure] publicstaticvoid StoredProcedure1()
{
// Put your code here
SqlCommand cmd =SqlContext.GetCommand();
cmd.CommandText="select firstname + ' ' + lastname + as [name] from person.contact";
SqlDataReader rdr = cmd.ExecuteReader();
SqlPipe sp =SqlContext.GetPipe();
sp.Send(rdr);
}};
Hi,
yes that has changed quite a bit till SQL 2005's RTM. Something like
using(SqlConnection connection = new SqlConnection("context connection=true"))
{
connection.Open();
SqlCommand cmd=new SqlCommand("select firstname + ' ' + lastname + as [name] from person.contact",connection);
SqlContext.Pipe.ExecuteAndSend(cmd);
}
For more information:http://msdn2.microsoft.com/en-us/library/ms190790.aspx
Assembly Clash between June and July CTP in VS.NET/SQL Express
BTW, I tried to install XM and do an export but it also doesn't run with the July CTP. Aaaaaarrrrrgggghhhh....me too!
When I depoly a Sql Server Project in vs2005, It not work:
Common Language Runtime(CLR) v2.0.50215 not installed properly. The CLR is required to use SQL/CLR features.
|||Could you please explain what versioning problems you are facing? A series of steps you took and the related error messages would be helpful.
Thanks,
-Vineet.|||This means your .NET Framework installation didnt occur successfully. Try uninstalling and reinstalling just CLR.
Thanks,
-Vineet|||
My sql express was installed with the installation of vs2005 beta 2 ( .NetFramework build 50712), I don't know why it requires the build 50215.
Can I switch sql express to 50712 ?
I have a simmiliar problem with sql.
The june CTP of SQL Server wont install with july CTP of VS2005 TS. I found out that they are using different versions of .NET 2.0.
Now what i had a laugh with was the fact that sql express that ships with VS2005 TS july CTP is from SQL June CTP. The visual studio installer automatically installs it just fine, but if you try to install it manually you get an error for an incompatible version of .net framework and vs :S
|||Yes, the last compatible version of SQL Server and VS for CLR Integration features was June CTP. The next compatible version would be september CTP.
You can use all other features of SQL Express besides CLR integration in VS CTPs in between.
Thanks,
-Vineet.
Assembly access SQL DB don't work in Windows Server 2003
Server 2003. The assembly must access a SQL Server database on the same SQL
Server as Reporting Services (localhost)
The assembly is written with VB .NET 2003. I have a assembly running
accessing a oracle db, this assembly works. So I know the security settings
etc. But the problem must be somewhere in detail. Therefore detailed answers
are appreciated.
The assembly works in the designer but not in Report Server on Windows
Server 2003. The assembly get accessed by the report server but obviously the
database connection failed.
Content bellow:
- rsvPolicy.config settings
- Code in assembly
- Additional information
Settings in the rsvPolicy.config:
<PermissionSet class="NamedPermissionSet"
version="1"
Name="MyNewFilePermissionSet"
Description="A special permission set that grants read access to my file.">
<IPermission class="System.Data.OleDb.OleDbPermission"
version="1"
Flags="Assertion, Execution"/>
</PermissionSet>
<PermissionSet class="NamedPermissionSet"
version="1"
Name="MyNewFilePermissionSet"
Description="A special permission set that grants read access to my file.">
<IPermission class="System.Security.PermissionSet"
version="1"
Flags="Assertion, Execution"/>
</PermissionSet>
Code in the assembly
' declaration of the security object in the header of the class
Private m_objSecurity As System.Security.PermissionSet
Private m_strConnString As String = _
"Provider=SQLOLEDB;Data Source=localhost;Initial
Catalog=MyDatabase;Integrated Security=SSPI;"
' function to open the db
<PermissionSet(SecurityAction.Assert, Unrestricted:=True)> _
Public Function OpenDBConn() As Boolean
m_objSecurity = New PermissionSet(PermissionState.Unrestricted)
m_objSecurity.Assert()
m_objDBConn = New
System.Data.OleDB.OleDbConnection(m_strConnString)
m_objDBConn.Open()
If m_objDBConn.State = ConnectionState.Open Then
InitSQLSRVConn = True
End IF
Addional information:
IDE: .net 2003
SQL Server 2000 SP3a
Windows Server 2003
Reporting Services Enterprise Edition + SP 2The assembly works on a Windows 2000 (SP4) Machine.
For this reason I assume that the problem is related to Windows 2003 Server,
or with SP2 from Reporting Services in relation with Windows 2003 Server.
Just for the sake of completnes bellowe the code meanwhile tried on both
Systems (W2K and W2K3 Srv)
--
In rssrvpoliciy.config:
--
<PermissionSet class="NamedPermissionSet"
version="1"
Name="MyNewFilePermissionSet"
Description="A special permission set that grants access to SQL Server
Database.">
<IPermission class="System.Data.OleDB.OleDbPermission"
version="1"
Flags="Assertion, Execution"/>
</PermissionSet>
'--
' In the Assembly
'--
Private m_objSecurity As System.Data.OleDB.OleDbPermission
Private m_strConnString As String = _
"Provider=SQLOLEDB;Data Source=localhost;Initial
Catalog=myDatabase;Integrated Security=SSPI;"
<PermissionSet(SecurityAction.Assert, Unrestricted:=True)> _
Public Function InitSQLSRVConn() As Boolean
m_objSecurity = New
System.Data.OleDb.OleDbPermission(PermissionState.Unrestricted)
m_objSecurity.Assert()
m_objDBConn = New
System.Data.OleDB.OleDbConnection(m_strConnString)
m_objDBConn.Open()
If m_objDBConn.State = ConnectionState.Open Then
InitSQLSRVConn = True
End if
"Dev Main" wrote:
> I try to get a custom assembly running with Reporting Services on Windows
> Server 2003. The assembly must access a SQL Server database on the same SQL
> Server as Reporting Services (localhost)
> The assembly is written with VB .NET 2003. I have a assembly running
> accessing a oracle db, this assembly works. So I know the security settings
> etc. But the problem must be somewhere in detail. Therefore detailed answers
> are appreciated.
> The assembly works in the designer but not in Report Server on Windows
> Server 2003. The assembly get accessed by the report server but obviously the
> database connection failed.
> Content bellow:
> - rsvPolicy.config settings
> - Code in assembly
> - Additional information
> Settings in the rsvPolicy.config:
> <PermissionSet class="NamedPermissionSet"
> version="1"
> Name="MyNewFilePermissionSet"
> Description="A special permission set that grants read access to my file.">
> <IPermission class="System.Data.OleDb.OleDbPermission"
> version="1"
> Flags="Assertion, Execution"/>
> </PermissionSet>
> <PermissionSet class="NamedPermissionSet"
> version="1"
> Name="MyNewFilePermissionSet"
> Description="A special permission set that grants read access to my file.">
> <IPermission class="System.Security.PermissionSet"
> version="1"
> Flags="Assertion, Execution"/>
> </PermissionSet>
>
> Code in the assembly
> ' declaration of the security object in the header of the class
> Private m_objSecurity As System.Security.PermissionSet
> Private m_strConnString As String = _
> "Provider=SQLOLEDB;Data Source=localhost;Initial
> Catalog=MyDatabase;Integrated Security=SSPI;"
> ' function to open the db
> <PermissionSet(SecurityAction.Assert, Unrestricted:=True)> _
> Public Function OpenDBConn() As Boolean
> m_objSecurity = New PermissionSet(PermissionState.Unrestricted)
> m_objSecurity.Assert()
> m_objDBConn = New
> System.Data.OleDB.OleDbConnection(m_strConnString)
> m_objDBConn.Open()
> If m_objDBConn.State = ConnectionState.Open Then
> InitSQLSRVConn = True
> End IF
>
> Addional information:
> IDE: .net 2003
> SQL Server 2000 SP3a
> Windows Server 2003
> Reporting Services Enterprise Edition + SP 2
>
>|||At least the version in my second post works correct. The reason for the
failure was a other mistake not related to reporting services at all.
"Dev Main" wrote:
> I try to get a custom assembly running with Reporting Services on Windows
> Server 2003. The assembly must access a SQL Server database on the same SQL
> Server as Reporting Services (localhost)
> The assembly is written with VB .NET 2003. I have a assembly running
> accessing a oracle db, this assembly works. So I know the security settings
> etc. But the problem must be somewhere in detail. Therefore detailed answers
> are appreciated.
> The assembly works in the designer but not in Report Server on Windows
> Server 2003. The assembly get accessed by the report server but obviously the
> database connection failed.
> Content bellow:
> - rsvPolicy.config settings
> - Code in assembly
> - Additional information
> Settings in the rsvPolicy.config:
> <PermissionSet class="NamedPermissionSet"
> version="1"
> Name="MyNewFilePermissionSet"
> Description="A special permission set that grants read access to my file.">
> <IPermission class="System.Data.OleDb.OleDbPermission"
> version="1"
> Flags="Assertion, Execution"/>
> </PermissionSet>
> <PermissionSet class="NamedPermissionSet"
> version="1"
> Name="MyNewFilePermissionSet"
> Description="A special permission set that grants read access to my file.">
> <IPermission class="System.Security.PermissionSet"
> version="1"
> Flags="Assertion, Execution"/>
> </PermissionSet>
>
> Code in the assembly
> ' declaration of the security object in the header of the class
> Private m_objSecurity As System.Security.PermissionSet
> Private m_strConnString As String = _
> "Provider=SQLOLEDB;Data Source=localhost;Initial
> Catalog=MyDatabase;Integrated Security=SSPI;"
> ' function to open the db
> <PermissionSet(SecurityAction.Assert, Unrestricted:=True)> _
> Public Function OpenDBConn() As Boolean
> m_objSecurity = New PermissionSet(PermissionState.Unrestricted)
> m_objSecurity.Assert()
> m_objDBConn = New
> System.Data.OleDB.OleDbConnection(m_strConnString)
> m_objDBConn.Open()
> If m_objDBConn.State = ConnectionState.Open Then
> InitSQLSRVConn = True
> End IF
>
> Addional information:
> IDE: .net 2003
> SQL Server 2000 SP3a
> Windows Server 2003
> Reporting Services Enterprise Edition + SP 2
>
>
Sunday, February 19, 2012
ASPNET permissions error when trying to open an Oracle connectin from a custom assembly.
I'm receiving the following error while trying to open an Oracle connection
from a custom assembly; it seems that ASP.NET has insufficient permissions.
OracleConnection oc = null;
// v-- creating connection object, this
is where the exception throws..
oc = new OracleConnection(Def.ConnectString +
";User Id=" + Def.UserName + ";Password=pwdtxt");
I've assigned "FullTrust" to all the CodeGroup entries on my config files,
and I can execute the code in the custom assembly but I can not open a
database connection.
Is there any security setting related with this?
Thanks,
Daniel Bello.
<ErrorCode
xmlns="http://www.microsoft.com/sql/reportingservices">rsAccessDenied</ErrorCode><HttpStatus
xmlns="http://www.microsoft.com/sql/reportingservices">400</HttpStatus><Message
xmlns="http://www.microsoft.com/sql/reportingservices">The permissions
granted to user 'WCORPTWJTCCPB1\ASPNET' are insufficient for performing this
operation.</Message><HelpLink
xmlns="http://www.microsoft.com/sql/reportingservices">http://go.microsoft.com/fwlink/?LinkId=20476&EvtSrc=Microsoft.ReportingServices.Diagnostics.Utilities.ErrorStrings&EvtID=rsAccessDenied&ProdName=Microsoft%20SQL%20Server%20Reporting%20Services&ProdVer=9.00.1399.00</HelpLink><ProductName
xmlns="http://www.microsoft.com/sql/reportingservices">Microsoft SQL Server
Reporting Services</ProductName><ProductVersion
xmlns="http://www.microsoft.com/sql/reportingservices">9.00.1399.00</ProductVersion><ProductLocaleId
xmlns="http://www.microsoft.com/sql/reportingservices">127</ProductLocaleId><OperatingSystem
xmlns="http://www.microsoft.com/sql/reportingservices">OsIndependent</OperatingSystem><CountryLocaleId
xmlns="http://www.microsoft.com/sql/reportingservices">1033</CountryLocaleId><MoreInformation
xmlns="http://www.microsoft.com/sql/reportingservices"><Source>ReportingServicesLibrary</Source><Message
msrs:ErrorCode="rsAccessDenied"
msrs:HelpLink="http://go.microsoft.com/fwlink/?LinkId=20476&EvtSrc=Microsoft.ReportingServices.Diagnostics.Utilities.ErrorStrings&EvtID=rsAccessDenied&ProdName=Microsoft%20SQL%20Server%20Reporting%20Services&ProdVer=9.00.1399.00"
xmlns:msrs="http://www.microsoft.com/sql/reportingservices">The permissions
granted to user 'WCORPTWJTCCPB1\ASPNET' are insufficient for performing this
operation.</Message></MoreInformation><Warnings
xmlns="http://www.microsoft.com/sql/reportingservices" />I added the ASPNET user to HOME with Browser and Content Manager permissions
and it works now.
Does anyoune has an explanation for this?
Thanks,
Daniel Bello.
"Daniel Bello" <dburizarri@.yahoo.es> wrote in message
news:OzjxxzYRHHA.4000@.TK2MSFTNGP04.phx.gbl...
> Hello:
> I'm receiving the following error while trying to open an Oracle
> connection from a custom assembly; it seems that ASP.NET has insufficient
> permissions.
> OracleConnection oc = null;
> // v-- creating connection object, this
> is where the exception throws..
> oc = new OracleConnection(Def.ConnectString +
> ";User Id=" + Def.UserName + ";Password=pwdtxt");
> I've assigned "FullTrust" to all the CodeGroup entries on my config files,
> and I can execute the code in the custom assembly but I can not open a
> database connection.
> Is there any security setting related with this?
> Thanks,
> Daniel Bello.
> <ErrorCode
> xmlns="rsAccessDenied</ErrorCode><HttpStatus">http://www.microsoft.com/sql/reportingservices">rsAccessDenied</ErrorCode><HttpStatus
> xmlns="400</HttpStatus><Message">http://www.microsoft.com/sql/reportingservices">400</HttpStatus><Message
> xmlns="The">http://www.microsoft.com/sql/reportingservices">The permissions
> granted to user 'WCORPTWJTCCPB1\ASPNET' are insufficient for performing
> this operation.</Message><HelpLink
> xmlns="http://go.microsoft.com/fwlink/?LinkId=20476&EvtSrc=Microsoft.ReportingServices.Diagnostics.Utilities.ErrorStrings&EvtID=rsAccessDenied&ProdName=Microsoft%20SQL%20Server%20Reporting%20Services&ProdVer=9.00.1399.00</HelpLink><ProductName">http://www.microsoft.com/sql/reportingservices">http://go.microsoft.com/fwlink/?LinkId=20476&EvtSrc=Microsoft.ReportingServices.Diagnostics.Utilities.ErrorStrings&EvtID=rsAccessDenied&ProdName=Microsoft%20SQL%20Server%20Reporting%20Services&ProdVer=9.00.1399.00</HelpLink><ProductName
> xmlns="Microsoft">http://www.microsoft.com/sql/reportingservices">Microsoft SQL
> Server Reporting Services</ProductName><ProductVersion
> xmlns="9.00.1399.00</ProductVersion><ProductLocaleId">http://www.microsoft.com/sql/reportingservices">9.00.1399.00</ProductVersion><ProductLocaleId
> xmlns="127</ProductLocaleId><OperatingSystem">http://www.microsoft.com/sql/reportingservices">127</ProductLocaleId><OperatingSystem
> xmlns="OsIndependent</OperatingSystem><CountryLocaleId">http://www.microsoft.com/sql/reportingservices">OsIndependent</OperatingSystem><CountryLocaleId
> xmlns="1033</CountryLocaleId><MoreInformation">http://www.microsoft.com/sql/reportingservices">1033</CountryLocaleId><MoreInformation
> xmlns="<Source>ReportingServicesLibrary</Source><Message">http://www.microsoft.com/sql/reportingservices"><Source>ReportingServicesLibrary</Source><Message
> msrs:ErrorCode="rsAccessDenied"
> msrs:HelpLink="http://go.microsoft.com/fwlink/?LinkId=20476&EvtSrc=Microsoft.ReportingServices.Diagnostics.Utilities.ErrorStrings&EvtID=rsAccessDenied&ProdName=Microsoft%20SQL%20Server%20Reporting%20Services&ProdVer=9.00.1399.00"
> xmlns:msrs="The">http://www.microsoft.com/sql/reportingservices">The
> permissions granted to user 'WCORPTWJTCCPB1\ASPNET' are insufficient for
> performing this operation.</Message></MoreInformation><Warnings
> xmlns="http://www.microsoft.com/sql/reportingservices" />
>