【发布时间】: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 没有改变.. 我在登台服务器上部署时没有这个本地问题