windows 应用程序 "SubSonic.SqlQuery.ExecuteAsCollection[ListType]()" 出错

Error in windows application "SubSonic.SqlQuery.ExecuteAsCollection[ListType]()"

我是 运行 windows 应用程序 (x86) 平台 windows 服务器 2012(x64),我正在使用 SubSonic 从 SQLserver 获取数据。

我从 try catch Exception 中得到了这个错误

at SubSonic.SqlQuery.ExecuteAsCollectionListType at CIS.Server.Automailer.Core.ReportConfig.getReportConfig() at CIS.Server.Automailer.Automailer.processDownload() at 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>();
        }

    }
}

您的 database 似乎有问题。因为您现在的访问权限在服务器上。

check your data if both exist on your local and on the Server.