1

我試圖軟件轉移到新服務器,並不能獲得通過這樣的錯誤: Error tripped on server報告服務2005年執行錯誤

被觸發這個錯誤如下,但我不認爲這是代碼問題。我很確定它必須處理在服務器上設置不正確的東西,因爲唯一改變的是服務器信息?任何想法如何彌補這個錯誤?

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<string>(Queryable.Select<vw_ProductClientInfo, string>(Queryable.Where<vw_ProductClientInfo>((IQueryable<vw_ProductClientInfo>)classes1DataContext.GetTable<vw_ProductClientInfo>(), (Expression<Func<vw_ProductClientInfo, bool>>)(c => c.CaseNumberKey == matchedCaseNumber)), (Expression<Func<vw_ProductClientInfo, string>>)(c => c.Description))); 
        string str1 = Queryable.SingleOrDefault<string>(Queryable.Select<vw_ProductClientInfo, string>(Queryable.Where<vw_ProductClientInfo>((IQueryable<vw_ProductClientInfo>)classes1DataContext.GetTable<vw_ProductClientInfo>(), (Expression<Func<vw_ProductClientInfo, bool>>)(c => c.CaseNumberKey == matchedCaseNumber)), (Expression<Func<vw_ProductClientInfo, string>>)(c => c.Summary))); 
        string str2 = Queryable.SingleOrDefault<string>(Queryable.Select<vw_ProductClientInfo, string>(Queryable.Where<vw_ProductClientInfo>((IQueryable<vw_ProductClientInfo>)classes1DataContext.GetTable<vw_ProductClientInfo>(), (Expression<Func<vw_ProductClientInfo, bool>>)(c => c.CaseNumberKey == matchedCaseNumber)), (Expression<Func<vw_ProductClientInfo, string>>)(c => string.Format("{0:C}", (object)c.Total)))); 
        string str3 = Queryable.SingleOrDefault<string>(Queryable.Select<vw_ProductClientInfo, string>(Queryable.Where<vw_ProductClientInfo>((IQueryable<vw_ProductClientInfo>)classes1DataContext.GetTable<vw_ProductClientInfo>(), (Expression<Func<vw_ProductClientInfo, bool>>)(c => c.CaseNumberKey == matchedCaseNumber)), (Expression<Func<vw_ProductClientInfo, string>>)(c => c.BRTNumber))); 
        MailMessage message = new MailMessage("[email protected]", Queryable.SingleOrDefault<string>(Queryable.Select<vw_ProductClientInfo, string>(Queryable.Where<vw_ProductClientInfo>((IQueryable<vw_ProductClientInfo>)classes1DataContext.GetTable<vw_ProductClientInfo>(), (Expression<Func<vw_ProductClientInfo, bool>>)(c => c.CaseNumberKey == matchedCaseNumber)), (Expression<Func<vw_ProductClientInfo, string>>)(c => c.Email))), "Report for Property " + Queryable.SingleOrDefault<string>(Queryable.Select<vw_ProductClientInfo, string>(Queryable.Where<vw_ProductClientInfo>((IQueryable<vw_ProductClientInfo>)classes1DataContext.GetTable<vw_ProductClientInfo>(), (Expression<Func<vw_ProductClientInfo, bool>>)(c => c.CaseNumberKey == matchedCaseNumber)), (Expression<Func<vw_ProductClientInfo, string>>)(c => c.Premises))), "Tax Information Certificate."); 
        MailAddress mailAddress = new MailAddress("[email protected]"); 
        ((Collection<MailAddress>)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()); 
       } 
      } 
     } 


    } 
} 
+0

檢查服務器上IIS中虛擬文件夾的權限以及身份驗證設置。這很可能是錯誤的來源。如果可能的話,與以前使用的服務器進行比較 – jpw

+0

今天早上我改變了代碼來傳遞證書。現在它將發送1份報告,並且在表格中的其餘案例中失敗。越來越近!其他情況下的登錄失敗。所以它的第一個工作,然後失敗的未來10或任何需要發送。 – korrowan

回答

1

問題是機器名稱已更改,但更改從未實際佔用,因此登錄無效。從WIN-2MUFL6FJSPL更改的計算機名ACME無法正常工作,因此嘗試從應用程序登錄失敗時。