我有一个.NET控制台应用程序,它运行在安装了AutoSys和WebSphere MQ的Windows Server 2008上(该应用程序用于向WebSphere MQ发送消息)。
我正在尝试设置一个每10分钟调用一次控制台应用程序的AutoSys作业。
如果我登录服务器并使用命令行运行应用程序,则应用程序可以正常工作。
但是如果我使用AutoSys运行应用程序,我会收到以下错误:
The type initializer for 'IBM.WMQ.MQQueueManager' threw an exception.
StackTrace = at IBM.WMQ.MQQueueManager..ctor(String queueManagerName, Hashtable properties)
at SendMessage.QueueJobExecutionItem.ExecuteQueueJob(QueueInfo queueInfo, CrmInfo crmInfo, LogFileInfo logFileInfo, List`1 entityList) in C:\SendMessage\QueueJobExecutionItem.cs:line 36
at SendMessage.Program.StartLoad() in C:\SendMessage\Program.cs:line 75
at SendMessage.Program.Main(String[] args) in C:\SendMessage\Program.cs:line 111
Error Message InnerException = The type initializer for 'IBM.WMQ.MQQueueManager' threw an exception.
InnerException StackTrace = at IBM.WMQ.MQQueueManager..ctor(String queueManagerName, Hashtable properties)
at SendMessage.QueueJobExecutionItem.ExecuteQueueJob(QueueInfo queueInfo, CrmInfo crmInfo, LogFileInfo logFileInfo, List`1 entityList) in C:\SendMessage\QueueJobExecutionItem.cs:line 36
at SendMessage.Program.StartLoad() in C:\SendMessage\Program.cs:line 75
at SendMessage.Program.Main(String[] args) in C:\SendMessage\Program.cs:line 111
InnerException Source = amqmdnet
Error Message InnerException = Exception has been thrown by the target of an invocation.
InnerException StackTrace = at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at IBM.WMQ.CommonServices.CreateCommonServices()
at IBM.WMQ.CommonServices.TraceConstructor(String objectId, String sccsid)
at IBM.WMQ.Nmqi.NmqiEnvironment..ctor(NmqiPropertyHandler nmqiPropertyHandler)
at IBM.WMQ.Nmqi.NmqiFactory.GetInstance(NmqiPropertyHandler properties)
at IBM.WMQ.MQQueueManager..cctor()
InnerException Source = mscorlib
Error Message InnerException = An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
InnerException StackTrace = at IBM.WMQ.MQCommonServices.xcsInitialize(UInt16 scope, UInt16 attributes, Byte[] charName, Byte[] charPrefix, xcsHPOOL& hPool)
at IBM.WMQ.MQCommonServices.Initialize()
InnerException Source = amqmdxcs
我在登录服务器并运行AutoSys时使用相同的用户,所以我希望应用程序以相同的方式运行。
我想知道是否有人之前有这个问题,或者是否有任何配置/参数等我可能在AutoSys中丢失,这将使应用程序以与登录服务器时相同的方式工作。
我希望这是有道理的
提前致谢
答案 0 :(得分:1)
异常显示An attempt was made to load a program with an incorrect format.
并指向amqmdxcs.dll
这可能是因为您的应用程序是64位但它正在尝试加载32位版本的WMQ库或您的应用程序是32位但正在尝试加载64位版本的WMQ库。您需要检查AutoSys的位数并设置加载适当WMQ库的路径。