Render SSRS 2008 Report from Website to Adobe PDF

This is a test project to see if l can successfully render to PDF from an website, using Report Control from a Visual Studio 2008 project.
First l created a simple sample table called MyContact from some files from the AdventureWorks database. Heres the code:

    [ContactID]      ,[Title]      ,[FirstName]      ,[LastName]
      ,[EmailAddress]      ,[Phone]      ,[ModifiedDate]
      into MyContacts
  FROM [AdventureWorks].[Person].[Contact]

If you wish to create the table directly, heres the code:

USE [AdventureWorks]
/****** Object:  Table [dbo].[MyContacts]    Script Date: 01/15/2009 22:34:31 ******/
CREATE TABLE [dbo].[MyContacts](
 [ContactID] [int] IDENTITY(1,1) NOT NULL,
 [Title] [nvarchar](8) NULL,
 [FirstName] [dbo].[Name] NOT NULL,
 [LastName] [dbo].[Name] NOT NULL,
 [EmailAddress] [nvarchar](50) NULL,
 [Phone] [dbo].[Phone] NULL,
 [ModifiedDate] [datetime] NOT NULL

I’ll attach a link to a text file with data for populating this with over 19,000 rows, as well as a link to the entire source code.
Heres a link to the Report Webpage. (should be active soon)
Currently l’m trying to debug the error below:

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 ‘Microsoft.ReportViewer.WebForms, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The system cannot find the file specified.

Source Error:

Line 53:     <add assembly="System.Design, Version=, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
Line 54:     <add assembly="System.Windows.Forms, Version=, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
Line 55:     <add assembly="Microsoft.ReportViewer.WebForms, Version=, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
Line 56:     <add assembly="Microsoft.ReportViewer.Common, Version=, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
Line 57:    </assemblies>



WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLMSoftwareMicrosoftFusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLMSoftwareMicrosoftFusion!EnableLog].

This seems to be a possible solution to this problem.

Reportviewer control

Here is a code snippet l got working which enables you to render using Visual Basic .Net an SSRS (Sql Server Report Services) Report to Adobe Acrobat PDF format or Microsoft Excel XLS file.

Public Sub RenderReportTOExcel(ByVal inReportFileName As String, ByVal inReportName As String)   ‘7/14/2008 SM

        ‘converts SSRS report to microsoft excel/acrobat pdf file

        Dim objReportViewer As New FrmWithReportViewer
                ‘Dim strFormat As String = “PDF”
        Dim strFormat As String = “Excel”
        Dim strDeviceInfo As String = String.Empty
        Dim myURLAccessParams As System.Collections.Specialized.NameValueCollection = Nothing
        Dim reportStream As System.IO.Stream = Nothing
        Dim strMimeType As String = String.Empty
        Dim strFileNameExtension As String = String.Empty

        Dim file_name As String = “d:test001.xls”
        objReportViewer.Text = inReportName

        OFD.FileName = “exportfile.xls”
        file_name = OFD.FileName

        Dim raw As System.IO.FileStream = New System.IO.FileStream(file_name, IO.FileMode.Create)
        Dim buffer(1024) As Byte
        Dim read As Integer = -1
        Dim intCount As Integer = 1


        With objReportViewer.ReportViewer
            .ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote
            .ServerReport.ReportServerUrl = New Uri(My.Settings.ReportServerURL)
            .ServerReport.ReportPath = My.Settings.ReportPath + inReportFileName
            reportStream = .ServerReport.Render(strFormat, strDeviceInfo, myURLAccessParams, strMimeType, strFileNameExtension)

            lblMessage.Text = “Working…”
            read = reportStream.Read(buffer, 0, buffer.Length)

            While (read > 0)
                raw.Write(buffer, 0, read)
                read = reportStream.Read(buffer, 0, buffer.Length)
                intCount += 1
            End While

            lblMessage.Text = “Completed.”

        End With

        raw = Nothing
        reportStream = Nothing

    End Sub