【问题标题】:Exception Info: System.IO.FileLoadException when running exe on production异常信息:在生产中运行 exe 时出现 System.IO.FileLoadException
【发布时间】:2017-06-12 14:32:47
【问题描述】:

我在 .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()

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

【问题讨论】:

  • 你能展示你处理任何文件的代码吗?
  • 检查权限?
  • 查看本地 bin 文件夹中的所有文件(尤其是 exe 和 dll)。将其与生产机器上的所有文件进行比较。生产机器上是否缺少本地机器上的任何内容?
  • 服务器上是否安装了 .NET 4.5?你能发布在启动时运行的代码吗?
  • And as far I can see - 所以你已经并排列出了文件,它们是一样的吗? 一模一样

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


【解决方案1】:

尝试将目标 CPU 设为 x86

【讨论】:

  • 这是评论而非答案。
猜你喜欢
  • 2014-06-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-07-22
  • 1970-01-01
  • 2018-06-23
  • 2023-03-06
相关资源
最近更新 更多