【问题标题】:Exception Devart.Data.Linq on a server "Devart.Data.Oracle.Linq.Provider"服务器“Devart.Data.Oracle.Linq.Provider”上的异常 Devart.Data.Linq
【发布时间】:2018-03-09 03:04:32
【问题描述】:

我正在尝试在 Windows server 2007 32 位上部署我的应用程序。 我的应用程序给了我这个例外

打开 DbConnection 时出错。北 Devart.Data.Linq.LinqCommandExecutionException.CanThrowLinqCommandExecutionException (字符串消息,异常 e) 北 Devart.Data.Linq.Provider.k.a.g() 北 Devart.Data.Linq.Provider.k.a.b(IConnectionUser A_0) 北 Devart.Data.Linq.Provider.k.b(IConnectionUser A_0) 北 Devart.Data.Linq.Provider.DataProvider.ExecuteQuery(CompiledQuery 编译查询,对象[] parentArgs,对象[] userArgs,对象 lastResult) 北 Devart.Data.Linq.Provider.DataProvider.ExecuteAllQueries(CompiledQuery 编译查询,对象[] userArguments) bei Devart.Data.Linq.Provider.DataProvider.CompiledQuery.Devart.Data.Linq.Provider.ICompiledQuery.Execute(IProvider provider, Object[] userArgs) 北 Devart.Data.Linq.DataQuery`1.i() 北 System.Collections.Generic.List`1..ctor(IEnumerable`1 集合) bei System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)

在我的程序中执行这一行时

var list = clientCustomers.ToList();

代码

    public Repository(String Connection, String EventPackageName, String EventScopeName)
    {
        this.connectionDict = this.getConnectionInfo(Connection);

        //this.context = new DataContext(connection);//old way
        this.context = new DataContext(Connection, new Devart.Data.Oracle.Linq.Provider.OracleDataProvider());

        this.eventContext = new EventPacDataContext(Connection);
        this.eContext = new Context.EventPacDataContext(Connection, new Devart.Data.Oracle.Linq.Provider.OracleDataProvider());

        this.eventPackageName = EventPackageName;
        this.eventScopeName = EventScopeName;
        this.clientUserName = this.connectionDict["User Id"];
    }

    /// <summary>
    /// Collect all Customers from VIEW
    /// </summary>
    /// <returns>IQueryable<Customer></returns>
    public IQueryable<Customer> GetCustomers()
    {
        try
        {

            var result = from p in this.context.YDEVQUALIBASICs
                         join extended in this.context.YDEVQUALIBASICEXTENDEDs on
                         p.ACCOUNTID equals extended.ACCOUNTID
                         select
                         new Customer
                         {
                             Base = new Customer
                             {
                                 CustomerId = p.CUSTOMERID.ToString(),
                                 CustomerNo = p.CUSTOMERNO.ToString(),
                                 Geburtsdatum = p.DETGEBURTSDATUM.GetValueOrDefault(new DateTime(1900, 1, 1)),
                                 Email = p.DETEMAIL,
                                 BusinessArea = p.ACCBUSINESSAREA,
                                 ContractType = p.ACCCONTRACTTYPE,
                                 ContractTariff = p.ACCCONTRACTARIFF,
                                 SubscribeChannel = p.DETANMELDEKANAL,
                                 PaymentMethod = p.CUSCOLLECTIONIDENT,

                                 CustomerAddress = new Address
                                 {
                                     City = p.CUSCITY,
                                     Street = p.CUSSTREET,
                                     ExtendedInfo = p.CUSEHNR,
                                     StreetNumber = p.CUSHNR,
                                     LCountry = p.CUSCOUNTRYL,
                                     SCountry = p.CUSCOUNTRYS,
                                     ZipCode = p.CUSZIPCODE
                                 },

                                     AccountPerson = new Person
                                     {
                                         Salutation = p.ACCANREDE,
                                         Title = p.ACCAKADEM,
                                         Branche = p.ACCBRANCHE,
                                         Lastname = p.ACCTOMERNAME1,
                                         Firstname = p.ACCTOMERNAME2,
                                         Name3 = p.ACCTOMERNAME3
                                     }
                                 },
                                 CustomerPerson = new Person
                                 {
                                     Salutation = p.CUSANREDE,
                                     Title = p.CUSAKADEM,
                                     Branche = p.CUSBRANCHE,
                                     Lastname = p.CUSTOMERNAME1,
                                     Firstname = p.CUSTOMERNAME2,
                                     Name3 = p.CUSTOMERNAME3
                                 },

                             InternGeolocChecked = extended.DETINTERNGEOLOCCHECKED,
                             InternGeolocStatus = extended.DETINTERNGEOLOCSTATUS,
                         };

            return result;

        }
        catch (ReflectionTypeLoadException ex)
        {
            StringBuilder sb = new StringBuilder();
            foreach (Exception exSub in ex.LoaderExceptions)
            {
                sb.AppendLine(exSub.Message);
                if (exSub is FileNotFoundException)
                {
                    FileNotFoundException exFileNotFound = exSub as FileNotFoundException;
                    if (!string.IsNullOrEmpty(exFileNotFound.FusionLog))
                    {
                        sb.AppendLine("Fusion Log:");
                        sb.AppendLine(exFileNotFound.FusionLog);
                    }
                }
                sb.AppendLine();
            }
            string errorMessage = sb.ToString();
            //Display or log the error based on your application.
            logger.Fatal("Aha: " + errorMessage);
            return null;
        }

        catch (Exception ex)
        {
            logger.Fatal("Customer failed: " + ex.Message + ex.StackTrace);
            throw new DataAccessException("Customer failed", ex);
        }
    }

【问题讨论】:

  • dbconnection 改变了吗?产生错误的代码在哪里?
  • 不,dbconnection 没有改变.. 我在登台服务器上部署时没有这个本地问题

标签: linq oracle devart


【解决方案1】:

部署使用 LinqConnect 编写的应用程序时,您应该注册运行时程序集 Devart.Data.Oracle.dll、Devart.Data.dll、Devart.Data.Oracle.Linq.dll 和 Devart.Data.Linq.dll在全局程序集缓存 (GAC) 中或将它们放在应用程序的文件夹中。 部署 ASP.NET 应用程序时,还需要有可用的 Devart.Data.Oracle.Web.dll 和 App_Licenses.dll 程序集。

如果您的项目所需的所有程序集都可用,请执行以下步骤:

  1. 确保您的计算机上安装了 Oracle 客户端软件;
  2. 在 Home 连接字符串参数中明确指定 Oracle Home 的名称。
  3. 将 ORACLE_HOME 变量的内容放在操作系统的 PATH 变量的第一个位置;
  4. 确保您的应用程序的容量(x86 或 x64)与您的 Oracle 客户端的容量相同。

如果执行这些步骤后问题仍然存在,请contact us 提供有关此问题的更多详细信息,例如:

  • 异常的完整堆栈跟踪;
  • 连接字符串;
  • Oracle 客户端的版本;
  • Oracle 服务器的版本;
  • 数据库表的定义及对应的实体类等

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-02-12
    • 1970-01-01
    • 2013-03-05
    • 1970-01-01
    • 2021-06-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多