2015-02-11 89 views
1

我在Windows Server 2012(x64)中运行Windows应用程序(x86)平台,我使用SubSonic从为SQLserver。错误在Windows应用程序“SubSonic.SqlQuery.ExecuteAsCollection [ListType]()”

我处 CIS.Server.Automailer.Automailer CIS.Server.Automailer.Core.ReportConfig.getReportConfig()得到的SubSonic.SqlQuery.ExecuteAsCollectionListType从尝试捕捉异常

此错误。 processDownload()在 CIS.Server.Automailer.Program.Main()

这里是我的源代码:

的Program.cs

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Windows.Forms; 
using System.IO; 

    namespace CIS.Server.Automailer 
    { 
     static class Program 
     { 
      [STAThread] 
      static void Main() 
      { 
       try 
       { 
        Application.EnableVisualStyles(); 
        Application.SetCompatibleTextRenderingDefault(false); 

        Automailer mailer = new Automailer(); 
        mailer.processDownload(); 

        Application.Run(); 
       } 
       catch(Exception ex) 
       { 
        Log(ex); 
       } 

      } 

      static void Log(Exception ex) 
      { 
       string stackTrace = ex.StackTrace; 
       File.WriteAllText("trace.txt", stackTrace); // path of file where stack trace will be stored. 
      } 
     } 
    } 

Automailer.cs

public void processDownload() 
    { 
     var data = ReportConfig.getReportConfig(); 
     var machineCenterIds = data[0].MachineCenterId; 
     var reportIds = data[0].ReportId; 
     var email = data[0].Email; 

     recipient = email; 
     string[] splitRepId = reportIds.Split(','); 
     int[] repIds = new int[splitRepId.Length]; 
     int c=0; 
     foreach (string repId in splitRepId) 
     { 
      repIds[c] = Convert.ToInt32(repId); 
      c++; 
     } 
     var reportNames = ReportConfig.getReportName(repIds); 
     string[] splitMcIds = machineCenterIds.Split(','); 

     int ctr = 0; 
     filePaths = new string[splitMcIds.Length * reportNames.Count()]; 

     ei.processFinished = false; 
     foreach (string mcId in splitMcIds) 
     { 
      for (int i = 0; i < reportNames.Count(); i++) 
      { 
       string reportName = Convert.ToString(reportNames[i]); 
       string url = Utility.GetTemporaryURL(mcId, reportName); 
       string fileName = reportName.Replace(" ", "");// + "_" + j + "_00" + i 
       downloadPath = string.Format(configPath, mcId, fileName); 
       filePaths[ctr] = downloadPath; 
       GenerateMails(url); 
       Console.WriteLine(downloadPath); 
       ctr++; 
      } 
     } 
     processEmail(); 
     ei.processFinished = true; 
    } 

ReportConfig.cs

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 

namespace CIS.Server.Automailer.Core 
{ 
    class ReportConfig 
    { 
     public static ReportAutomationCollection getReportConfig() 
     {  
      return DB.Select().From(ReportAutomation.Schema) 
        .Where(ReportAutomation.Columns.UserId).IsEqualTo("001111d6-cc2a-469a-a1bc-1ccd64e60a08") 
        .ExecuteAsCollection<ReportAutomationCollection>(); 
     } 

     public static ReportTypeCollection getReportName(int[] reportId) 
     { 
      return DB.Select(ReportType.Columns.ReportName).From(ReportType.Schema) 
           .Where(ReportType.ReportIdColumn).In(reportId.ToString()) 
           .ExecuteAsCollection<ReportTypeCollection>(); 
     } 

    } 
} 
+0

您是否在'getReportConfig()'中设置了断点? – Sayse 2015-02-11 07:32:57

+0

顺便说一句,这个应用程序在我的工作站(32位电脑)工作,这个错误只发生在我试图在Windows Server 2012(x64)中运行。 – 2015-02-11 07:40:18

+0

那么在这里没有太多的信息,我有一种感觉,你有一个支架在错误的地方,虽然....'.UserId).Isqual to' – Sayse 2015-02-11 07:48:45

回答

0

好像你有你的database一个问题。因为您的访问权限现在在服务器上。

检查您的数据是否存在于您的本地服务器和服务器上。

+0

你知道了Dyrandz,我发现错误是查找服务器上没有的数据。 – 2015-02-12 01:47:59