1

我正在尝试将软件传输到新服务器,但无法通过此错误: 服务器发生错误

触发此错误的代码如下,但我认为这不是问题。我很确定这与服务器上设置不正确的东西有关,因为唯一改变的是服务器信息?关于如何纠正此错误的任何想法?

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("Reports@aalacquest.com", 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("reports@aalacquest.com");
                    ((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());
                }
            }
        }


    }
}
4

1 回答 1

1

问题是机器名称已更改,但更改从未真正生效,因此登录无效。从 WIN-2MUFL6FJSPL 更改的机器名称 ACME 无法正常工作,因此尝试从应用程序登录时失败。

于 2014-03-11T14:39:33.580 回答