Reputation: 583
I am attempting to transfer software to a new server and cannot get pass this error:
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?
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());
}
}
}
}
}
Upvotes: 1
Views: 496
Reputation: 583
The issue was the the machine name was changed but the change never actually took hold therefore the login was invalid. The machine name ACME which was changed from WIN-2MUFL6FJSPL did not work correctly and therefore when trying to log in from an application failed.
Upvotes: 1