title: Reporting services 2005 execution error
body: <p>I am attempting to transfer software to a new server and cannot get pass this error:
  <img src="https://i.stack.imgur.com/iJVQx.png" alt="Error tripped on server"></p>
  
  <p>The code that is tripping this error is as follows but I don't think that is the issue.  I am pretty sure it has to do with something that was setup incorrectly on the server as the only thing that has changed is the server information?  Any idea on how to remedy this error?</p>
  
  <pre><code>namespace ReportGenerator
  {
      public partial class Form1 : Form
      {
          public Form1()
          {
              InitializeComponent();
          }
  
          private void button1_Click(object sender, EventArgs e)
          {
              try
              {
                  DataClasses1DataContext classes1DataContext = new DataClasses1DataContext();
                  foreach (reportsSent entity in classes1DataContext.reportsSents)
                  {
                      new Form1.MyReportRenderer().RenderTest(entity.CaseNumberKey);
                      classes1DataContext.reportsSents.DeleteOnSubmit(entity);
                  }
                  classes1DataContext.SubmitChanges();
              }
              catch (Exception ex)
              {
                  int num = (int)MessageBox.Show(((object)ex.StackTrace).ToString());
              }
          }
  
  
  
          public class MyReportRenderer
          {
              private rs2005.ReportingService2005 rs;
              private rs2005Execution.ReportExecutionService rsExec;
  
              public void RenderTest(String matchedCaseNumber)
              {
                  string HistoryID = (string)null;
                  string DeviceInfo = (string)null;
                  string MimeType = string.Empty;
                  string Encoding = string.Empty;
                  string Extension = string.Empty;
                  ReportGenerator.rs2005Execution.Warning[] Warnings = (ReportGenerator.rs2005Execution.Warning[])null;
                  string[] StreamIds = (string[])null;
                  this.rs = new ReportingService2005();
                  this.rsExec = new ReportExecutionService();
                  this.rs.Credentials = CredentialCache.DefaultCredentials;
                  this.rsExec.Credentials = CredentialCache.DefaultCredentials;
                  this.rs.Url = "http://www.aalacquest.com/ReportServer/ReportService2005.asmx";
                  this.rsExec.Url = "http://www.aalacquest.com/ReportServer/ReportExecution2005.asmx";
  
  
                  try
                  {
                      // Load the selected report.
                      this.rsExec.LoadReport("/LawDept/LawDeptTIC", HistoryID);
  
                      // Set the parameters for the report needed.
  
                      rs2005Execution.ParameterValue[] parameters = new rs2005Execution.ParameterValue[1];
                      parameters[0] = new rs2005Execution.ParameterValue();
                      parameters[0].Name = "CaseNumberKey";
                      parameters[0].Value = matchedCaseNumber;
  
                      rsExec.SetExecutionParameters(parameters, "en-us");
  
                      // get pdf of report 
                      byte[] buffer = this.rsExec.Render("PDF", DeviceInfo, out Extension, out MimeType, out Encoding, out Warnings, out StreamIds);
                      DataClasses1DataContext classes1DataContext = new DataClasses1DataContext();
                      Queryable.SingleOrDefault&lt;string&gt;(Queryable.Select&lt;vw_ProductClientInfo, string&gt;(Queryable.Where&lt;vw_ProductClientInfo&gt;((IQueryable&lt;vw_ProductClientInfo&gt;)classes1DataContext.GetTable&lt;vw_ProductClientInfo&gt;(), (Expression&lt;Func&lt;vw_ProductClientInfo, bool&gt;&gt;)(c =&gt; c.CaseNumberKey == matchedCaseNumber)), (Expression&lt;Func&lt;vw_ProductClientInfo, string&gt;&gt;)(c =&gt; c.Description)));
                      string str1 = Queryable.SingleOrDefault&lt;string&gt;(Queryable.Select&lt;vw_ProductClientInfo, string&gt;(Queryable.Where&lt;vw_ProductClientInfo&gt;((IQueryable&lt;vw_ProductClientInfo&gt;)classes1DataContext.GetTable&lt;vw_ProductClientInfo&gt;(), (Expression&lt;Func&lt;vw_ProductClientInfo, bool&gt;&gt;)(c =&gt; c.CaseNumberKey == matchedCaseNumber)), (Expression&lt;Func&lt;vw_ProductClientInfo, string&gt;&gt;)(c =&gt; c.Summary)));
                      string str2 = Queryable.SingleOrDefault&lt;string&gt;(Queryable.Select&lt;vw_ProductClientInfo, string&gt;(Queryable.Where&lt;vw_ProductClientInfo&gt;((IQueryable&lt;vw_ProductClientInfo&gt;)classes1DataContext.GetTable&lt;vw_ProductClientInfo&gt;(), (Expression&lt;Func&lt;vw_ProductClientInfo, bool&gt;&gt;)(c =&gt; c.CaseNumberKey == matchedCaseNumber)), (Expression&lt;Func&lt;vw_ProductClientInfo, string&gt;&gt;)(c =&gt; string.Format("{0:C}", (object)c.Total))));
                      string str3 = Queryable.SingleOrDefault&lt;string&gt;(Queryable.Select&lt;vw_ProductClientInfo, string&gt;(Queryable.Where&lt;vw_ProductClientInfo&gt;((IQueryable&lt;vw_ProductClientInfo&gt;)classes1DataContext.GetTable&lt;vw_ProductClientInfo&gt;(), (Expression&lt;Func&lt;vw_ProductClientInfo, bool&gt;&gt;)(c =&gt; c.CaseNumberKey == matchedCaseNumber)), (Expression&lt;Func&lt;vw_ProductClientInfo, string&gt;&gt;)(c =&gt; c.BRTNumber)));
                      MailMessage message = new MailMessage("Reports@aalacquest.com", Queryable.SingleOrDefault&lt;string&gt;(Queryable.Select&lt;vw_ProductClientInfo, string&gt;(Queryable.Where&lt;vw_ProductClientInfo&gt;((IQueryable&lt;vw_ProductClientInfo&gt;)classes1DataContext.GetTable&lt;vw_ProductClientInfo&gt;(), (Expression&lt;Func&lt;vw_ProductClientInfo, bool&gt;&gt;)(c =&gt; c.CaseNumberKey == matchedCaseNumber)), (Expression&lt;Func&lt;vw_ProductClientInfo, string&gt;&gt;)(c =&gt; c.Email))), "Report for Property " + Queryable.SingleOrDefault&lt;string&gt;(Queryable.Select&lt;vw_ProductClientInfo, string&gt;(Queryable.Where&lt;vw_ProductClientInfo&gt;((IQueryable&lt;vw_ProductClientInfo&gt;)classes1DataContext.GetTable&lt;vw_ProductClientInfo&gt;(), (Expression&lt;Func&lt;vw_ProductClientInfo, bool&gt;&gt;)(c =&gt; c.CaseNumberKey == matchedCaseNumber)), (Expression&lt;Func&lt;vw_ProductClientInfo, string&gt;&gt;)(c =&gt; c.Premises))), "Tax Information Certificate.");
                      MailAddress mailAddress = new MailAddress("reports@aalacquest.com");
                      ((Collection&lt;MailAddress&gt;)message.CC).Add(mailAddress);
                      SmtpClient smtpClient = new SmtpClient("localhost");
                      message.Attachments.Add(new Attachment((Stream)new MemoryStream(buffer), string.Format("{0}" + str3 + ".pdf", (object)"BRT")));
                      smtpClient.Send(message);
                  }
                  catch (Exception ex)
                  {
                      MessageBox.Show(ex.ToString());
                  }
              }
          }
  
  
      }
  }
  </code></pre>