异常信息:在生产上运行exe时出现System.IO.FileLoadException

时间:2017-06-12 14:32:47

标签: c# .net dependency-injection console-application octopus-deploy

我在 .net framework 4.5 中创建了一个导入控制台应用程序。 这些是我在我的应用程序中使用的包:

<packages>
  <package id="CSVReader" version="3.8.1" targetFramework="net40" />
  <package id="EnterpriseLibrary.Common" version="6.0.1304.0" targetFramework="net45" />
  <package id="EnterpriseLibrary.Data" version="6.0.1304.0" targetFramework="net45" />
  <package id="log4net" version="2.0.0" targetFramework="net40" />
  <package id="OctoPack" version="2.0.18" targetFramework="net40" />
</packages>

控制台应用程序在我的本地系统上运行得非常好但是当我尝试在服务器上部署它并运行exe时它会给我带来这个错误:

Faulting application name: app.exe, version: 1.0.0.0, time stamp: 0x58f0c4a0
Faulting module name: KERNELBASE.dll, version: 6.1.7601.23796, time stamp: 0x59029714
Exception code: 0xe0434352
Fault offset: 0x000000000001a06d
Faulting process id: 0x258
Faulting application start time: 0x01d2df846c72d791
Faulting application path: D:\filePath\app.exe
Faulting module path: C:\Windows\system32\KERNELBASE.dll

Application: app.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.FileLoadException
   at System.ModuleHandle.ResolveType(System.Reflection.RuntimeModule, Int32, IntPtr*, Int32, IntPtr*, Int32, System.Runtime.CompilerServices.ObjectHandleOnStack)
   at System.ModuleHandle.ResolveTypeHandleInternal(System.Reflection.RuntimeModule, Int32, System.RuntimeTypeHandle[], System.RuntimeTypeHandle[])
   at System.Reflection.RuntimeModule.ResolveType(Int32, System.Type[], System.Type[])
   at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(System.Reflection.CustomAttributeRecord, System.Reflection.MetadataImport, System.Reflection.Assembly ByRef, System.Reflection.RuntimeModule, System.Reflection.MetadataToken, System.RuntimeType, Boolean, System.Object[], System.Collections.IList, System.RuntimeType ByRef, System.IRuntimeMethodInfo ByRef, Boolean ByRef, Boolean ByRef)
   at System.Reflection.CustomAttribute.GetCustomAttributes(System.Reflection.RuntimeModule, Int32, Int32, System.RuntimeType, Boolean, System.Collections.IList, Boolean)
   at System.Reflection.CustomAttribute.GetCustomAttributes(System.Reflection.RuntimeAssembly, System.RuntimeType)
   at System.Attribute.GetCustomAttributes(System.Reflection.Assembly, System.Type, Boolean)
   at System.AppDomain.GetTargetFrameworkName()

有谁知道这个错误的可能原因是什么? 提前致谢 。

1 个答案:

答案 0 :(得分:-1)

尝试将目标CPU设为x86

相关问题