Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

CLR integration calling web service error Expand / Collapse
Author
Message
Posted Wednesday, September 7, 2011 2:49 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, February 7, 2013 7:40 AM
Points: 7, Visits: 52
Hi,
I have developed my clr integrated call according to the following logic:

1) call a SSRS report
2) save the report as a PDF in a specific folder location using foll code:

// get pdf of report
Byte[] results = rsExec.Render("PDF", deviceInfo,
out extension, out encoding,
out mimeType, out warnings, out streamIDs);

FileStream fs = new FileStream(@"C:\Temp\PDF\rep.pdf", FileMode.OpenOrCreate, FileAccess.Write);
fs.Write(results, 0, results.Length);
fs.Close();

3) I have created by assembly using sgen fine,
4) created the mapped stored proceedure to call the assembly defined code
CREATE PROCEDURE dbo.testSP
(
@Param(20)
)
AS EXTERNAL NAME
Assembly.[Assembly.StoredProcedures].sp_clr

5) However, whenever I exculte the SP, an error is always thrown as per below:

Msg 6522, Level 16, State 1, Procedure sp_clr, Line 0
A .NET Framework error occurred during execution of user-defined routine or aggregate "testSP":
System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
System.Security.SecurityException:
at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
at System.Security.CodeAccessPermission.Demand()
at System.Net.CredentialCache.get_DefaultCredentials()
at emlPDFStatement.StoredProcedures.sp_clr(String cust)

6) Because my clr code is writing a file, the error is most probably related to a security issue. I have used credidential that has the requiired rights.

7) I have googled the error and applied recommeded solutions but wihout any success.

I would be very much if any one could advise on the resolution or better point me to a small project that works fine along the above lines.

Thank you very much in advance.

Post #1170905
Posted Friday, September 9, 2011 4:49 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, February 7, 2013 7:40 AM
Points: 7, Visits: 52
Somehow I was creating my assembly with permisssion_set = safe and once I changed to EXTERNAL_ACCESS, it worked like a charm.

I have noted the detailed steps and if anyone is facing similar issue, then please let me know and I will help.

cheers
Post #1172385
Posted Monday, April 9, 2012 12:34 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Friday, December 12, 2014 2:56 AM
Points: 137, Visits: 262
Hi,
I want to use CLR Integration in Reporting Services,I want to apply the password security to report generated through SSRS 2008.
Please Help me.
Post #1280046
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse