1

EzApi用于创建SSIS包,包通过oledb连接管理器(microsoft.ace.oledb.12.0)读取excel文件当我在读取excel文件的数据流之后创建EzExecSQLTask对象时,

我得到了例外:object does not match the target type

调试 EzApi 代码后,我发现下面的行正在生成异常

host.Properties["TimeOut"].SetValue(host, value);

似乎当通过反射设置属性时,它找不到目标对象。

代码在 widows xp 机器上运行良好,但在 windows Server 2012 上它会导致问题。

堆栈跟踪

at System.Reflection.RuntimeMethodInfo.CheckConsistency(Object target)
   at System.Reflection.RuntimeMethodInfo.InvokeArgumentsCheck(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture)
   at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, Object[] index)
   at Microsoft.SqlServer.Dts.Runtime.ManagedHelper.ManagedPropertyHelper.SetPropertyValue(Object o, Int32 index, Object value)
   at Microsoft.SqlServer.Dts.Runtime.DtsProperty.SetValue(Object o, Object value)
   at Microsoft.SqlServer.SSIS.EzAPI.EzExecSqlTask.set_TimeOut(UInt32 value) in d:\ROI_ETL\ROi\ETL\Optime.ISS.ETL.EzApi\EzExecutables.cs:line 751
   at Microsoft.SqlServer.SSIS.EzAPI.EzExecSqlTask.InitializeTask() in d:\ROI_ETL\ROi\ETL\Optime.ISS.ETL.EzApi\EzExecutables.cs:line 740
   at Microsoft.SqlServer.SSIS.EzAPI.EzExecSqlTask..ctor(EzContainer parent) in d:\ROI_ETL\ROi\ETL\Optime.ISS.ETL.EzApi\EzExecutables.cs:line 732
   at Microsoft.SqlServer.SSIS.EzAPI.Common.ComponentWrapper.CreateSQLTaskWithExpression(EzContainer p, String name, String sql, EzConnectionManager cm) in d:\ROI_ETL\ROi\ETL\Optime.ISS.ETL.EzApi\Common\ComponentWrapper.cs:line 55
   at Microsoft.SqlServer.SSIS.EzAPI.SSI_Wrapper.SSIPackage.LogMessage(String stepID, String stepName, String userID, String statusID, String message, String sqlTaskName, EzExecutable attachToComp, EzConnectionManager cm) in d:\ROI_ETL\ROi\ETL\Optime.ISS.ETL.EzApi\SSI Wrapper\SSIPackage.cs:line 723
   at Microsoft.SqlServer.SSIS.EzAPI.SSI_Wrapper.SSIPackage.CreatePackage(Int64 userID, Nullable`1 sourceID, Int64 taskID, Boolean isSystemTask, StepDTO step, List`1 execStatus) in d:\ROI_ETL\ROi\ETL\Optime.ISS.ETL.EzApi\SSI Wrapper\SSIPackage.cs:line 178
   at Optime.ISS.ETL.WebAPI.SSISPackageController.ExecuteTask(TaskDTO task) in d:\ROI_ETL\ROi\ETL\Optime.ISS.ETL.WebAPI\SSISPackageController.cs:line 77

更多信息

当 microsoft.ace.oledb.12.0 用于连接到 excel 文件时,仅在 windows server 2012 上出现问题。相同的代码在带有 microsoft.ace.oledb.12.0 32 位驱动程序的 windows xp 中运行良好

请帮忙....我们可以继续前进。

请建议正确的论坛。

4

0 回答 0