CLR integration calling web service error

  • 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.

    🙂

  • 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

  • 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.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply