Iceman
Iceman

Reputation: 335

Reporting Services Custom Assembly

I created a custom assembly to convert RTF to plain text and it works nice with the following configuration: SSRS 2008, Win 2003 Server, rssrvpolicy.config changes, an Excecution Account, and IIS 6.0.

We created a new server running SSRS 2008R2, Win 2008, and IIS 7. It does not work on this new environment and I do not get any error, but instead the SSRS Service reboots itself. This only happens when I reference System.Windows.Forms.RichTextBox(). See code below.

Can anyone give me an idea of what I may need to do or test to get this working? I've checked the log files and the Event Viewer, but not seeing any errors. It does call my assembly and works if I just output some text to the report and not call the RichTextControl. It fails when I try to reference System.Windows.Forms.RichTextBox. I also installed to the GAC with no luck, but shouldn't need to(?) and didn't with the old version.

I also tried to put a try/catch block around the code to see if I could get the error. If I just throw an error, I get the message. If I call the RichTextBox control, it causes the SSRS service to reboot.

My code:

using System;
using System.Windows.Forms;
using System.Diagnostics;
namespace ConversionUtility
{
    public class ConversionUtility
    {
        [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Assert, Unrestricted = true)] 
        public static string ConvertRTFToText(string richText)
        {
            string sText = "";

            try
            {
                // if I comment out these 3 lines, this will work
                RichTextBox richTextBox = new System.Windows.Forms.RichTextBox();
                richTextBox.Rtf = richText;
                sText = richTextBox.Text;
                //throw new Exception("Log this error");
            }
            catch (Exception e)
            {
                sText = "Error Caught: " + e.Message;
            }

            return sText;
        }
    }
}

I have these permissions defined. I add the CodeGroup below and it works if I don't reference the RichTextBox. The service reboots as soon as I try to reference System.Forms.Windows.RichTextBox()

<CodeGroup
class="UnionCodeGroup"
version="1"
Name="SecurityExtensionCodeGroup"
Description="Code group Conversion Utility"
PermissionSetName="FullTrust">
<IMembershipCondition
    class="UrlMembershipCondition"
    version="1"
    Url="C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportServer\bin        \ConversionUtility.dll"
/>

I'm thinking it's having an issue with permissions to System.Windows.Forms, but haven't been able to figure out what I need to do.

Thanks in advance,

Randy

Upvotes: 0

Views: 1325

Answers (1)

Iceman
Iceman

Reputation: 335

I ended up contacting Microsoft because this should have worked. When I gave them a sample application in worked in their environment. It turned out that they had a hotfix installed for Reporting Services that I did not. After I installed the hotfix, everything worked.

build 10.50.1720 - applied CU2 for SSRS 2008 R2 RTM (http://support.microsoft.com/kb/2072493).

Upvotes: 2

Related Questions