vs2013 asp.net System.BadImageFormatException

The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.InvalidOperationException: The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine.

Source Error: 

The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:

1. Add a "Debug=true" directive at the top of the file that generated the error. Example:

<%@ Page Language="C#" Debug="true" %>

or:

2) Add the following section to the configuration file of your application:

<configuration>
<system.web>
<compilation debug="true"/>
</system.web>
</configuration>

Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.

Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.


Stack Trace: 

[InvalidOperationException: The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine.]
   System.Data.OleDb.OleDbServicesWrapper.GetDataSource(OleDbConnectionString constr, DataSourceWrapper& datasrcWrapper) +1761342
   System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection) +1777302
   System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject) +100
   System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup) +43
   System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +6296143
   System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +6296606
   System.Data.OleDb.OleDbConnection.Open() +48
   System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +292
   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +420
   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) +306
   System_HumanResources_KQ_Analysis.Data_Binding() +344
   System_HumanResources_KQ_Analysis.Page_Load(Object sender, EventArgs e) +247
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25
   System.Web.UI.Control.LoadRecursive() +71
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3048

 


 

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

 

把程序放在windows 2008 R2 64bit的服务器上,处理Excel时出现上面的错误。

解决方法,是到服务器的打开IIS管理器。go to Application Pool,找到对应站点的池。右击Advanced setting... 参考下图,把Enable 32-Bit Application 设为由False 为True。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: "System.BadImageFormatException" 是一个 .NET 框架中的异常类型,通常表示程序集或模块的格式无效。这通常是因为程序集或模块是针对不同的体系结构编译的,例如在 32 位和 64 位系统之间切换时,或者是因为程序集或模块已损坏或已篡改。要解决此问题,您可以尝试重新安装受影响的程序,或者检查程序集或模块是否已正确编译。 ### 回答2: system.badimageformatexception是一个异常类,它通常在读取或加载程序集时发生。这个异常意味着程序尝试加载一个格式错误的程序集,这通常是由于程序集已经被损坏或不完整的情况所致。 当应用程序出现system.badimageformatexception异常时,可能会有多种原因。首先,这可能是由于您下载的程序集已损坏或不完整,导致它无法正常加载。此外,这个异常也可能是由于程序集是错误的或者是与正在运行应用程序的操作系统不兼容所致。 要解决这个问题,您可以尝试重新下载程序集并再次加载它,或者从其他来源获取它。如果这仍然无效,您可以尝试重新安装操作系统来确保它与您的应用程序兼容。此外,您还可以检查一下您的代码,确保您正确地加载和使用程序集。当然,最好的方法是确保您选择可靠的程序集,以避免发生任何问题。 总之,system.badimageformatexception异常是一个常见的异常,在处理程序集时可能会发生。要解决这个问题,您需要仔细检查程序集,并确保它们是完整的、正确的、且与您的操作系统兼容。如果您仍然无法解决这个问题,您可以从其他方面获取支持来确保程序的功能正常。 ### 回答3: System.BadImageFormatException 是一种 .NET Framework 中发生的异常类型,通常是在运行或加载程序集时发生。这个异常通常是由于程序集文件的格式不正确或兼容性不匹配引起的。当你尝试加载不兼容的程序集,它就会抛出 BadImageFormatException。以下是一些可能导致 BadImageFormatException 异常的原因: 1.平台兼容性问题:程序集文件可能是在不同的平台上编译的,例如:尝试在32位应用程序中加载64位程序集或者反过来。这种情况下,CLR 将会抛出这种异常。 2.非托管程序集:当尝试加载非托管程序集时,如 C++ 程序集或者 COM 组件,也可能会出现 BadImageFormatException 异常。因为这些程序集不使用 Common Language Runtime(CLR)作为其宿主环境。 3. 引用错误的程序集:当程序集依赖的一个或多个程序集发生变化时,也有可能出现 BadImageFormatException 异常。这种情况下,CLR 会识别出来并抛出异常,因为它无法找到所需的程序集。 解决这个问题的方法可能会有所不同,具体取决于导致这个异常的原因。以下是一些常见的解决方法: 1.确保目标平台兼容:当你尝试加载程序集时,确保它与你的应用程序使用的平台兼容。如果你尝试使用不兼容的平台加载程序集,CLR 就会抛出 BadImageFormatException 异常。你可以通过在 Visual Studio 中的配置选项中进行更改,或选择使用 Platform Target 选项来解决此问题。 2.确保引用的程序集不存在问题:在加载程序集之前,请确保该程序集的所有依赖项都已正确安装。你可以使用程序集浏览器来检查这些依赖项。 3. 确保使用 .Net Framework 进行编译并安装了面向特定版本:当你将程序集添加到一个程序中时,请确保该程序集是使用 .NET Framework 编写并面向特定的 .NET Framework 版本进行编译的。如果你尝试使用不同版本的 .NET Framework 加载程序集,就会导致 BadImageFormatException 异常。因此,请确保你已经安装了正确的 .NET Framework 版本。 总之,System.BadImageFormatException 是一种常见的异常类型,通常是由于程序集格式不正确或兼容性不匹配引起的。你可以通过确保程序集与应用程序使用的平台兼容、检查程序集依赖项是否正确以及安装了正确的 .NET Framework 版本来解决此问题。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值