简体   繁体   English

“无法加载文件或程序集或其依赖项之一。 试图加载格式不正确的程序。”

[英]“Could not load file or assembly or one of its dependencies. An attempt was made to load a program with an incorrect format.”

while debugging in VS, the error will be raised when starting debug in VS.在 VS 中调试时,在 VS 中启动调试时会引发错误。

The error is below:错误如下:

Could not load file or assembly 'p4dn, Version=1.0.1.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format. 
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.BadImageFormatException: Could not load file or assembly 'p4dn, Version=1.0.1.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace: 


[BadImageFormatException: Could not load file or assembly 'p4dn, Version=1.0.1.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
   System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0
   System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +43
   System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +127
   System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +142
   System.Reflection.Assembly.Load(String assemblyString) +28
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +46

[ConfigurationErrorsException: Could not load file or assembly 'p4dn, Version=1.0.1.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +613
   System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +203
   System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +105
   System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +178
   System.Web.Compilation.BuildProvidersCompiler..ctor(VirtualPath configPath, Boolean supportLocalization, String outputAssemblyName) +54
   System.Web.Compilation.ApplicationBuildProvider.GetGlobalAsaxBuildResult(Boolean isPrecompiledApp) +232
   System.Web.Compilation.BuildManager.CompileGlobalAsax() +51
   System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +337

[HttpException (0x80004005): Could not load file or assembly 'p4dn, Version=1.0.1.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
   System.Web.Compilation.BuildManager.ReportTopLevelCompilationException() +58
   System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +512
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters) +729

[HttpException (0x80004005): Could not load file or assembly 'p4dn, Version=1.0.1.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +8921851
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +85
   System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +259

When i create a C# project which use 'p4dn.dll' there isn't this error coming across.当我创建一个使用“p4dn.dll”的 C# 项目时,不会出现此错误。

this is my first ASP project, i also read the similar questions like "http://stackoverflow.com/questions/41449/i-get-a-an-attempt-was-made-to-load-a-program-with-an-incorrect-format-error-o" and "http://stackoverflow.com/questions/1648213/could-not-load-file-or-assembly-xxx-or-one-of-its-dependencies-an-attempt-was".这是我的第一个 ASP 项目,我还阅读了类似的问题,例如“http://stackoverflow.com/questions/41449/i-get-a-an-attempt-was-made-to-load-a-program-with -an-incorrect-format-error-o”和“http://stackoverflow.com/questions/1648213/could-not-load-file-or-assembly-xxx-or-one-of-its-dependencies-an -尝试-是”。 They cannot address my problem.他们无法解决我的问题。

how can I solve this problem?我怎么解决这个问题?

There is now a menu option to run the 64bit version of IIS Express.现在有一个菜单选项可以运行 64 位版本的 IIS Express。 From Visual Studio menu select Tools -> Options... -> Projects and Solutions -> Web Projects从 Visual Studio 菜单中选择工具 -> 选项... -> 项目和解决方案 -> Web 项目

Click the button for "Use the 64 bit version of IIS Express for web sites and projects"单击“为网站和项目使用 64 位版本的 IIS Express”按钮

Go to Respective ==> Site Application Pool ,转到各自 ==> 站点应用程序池,

Click on ==> Advance Settings单击 ==> 高级设置

     Change value of ==> "Enable 32-Bit Applications" from  False to True 

I had this same error message trying to run (debug) a 64-bit MVC site using IIS Express 8.0.我在尝试使用 IIS Express 8.0 运行(调试)64 位 MVC 站点时遇到了同样的错误消息。 I verified that all my projects were targetting the x64 Platform.我确认我所有的项目都针对 x64 平台。

The problem was occurring because Visual Studio runs the 32-bit version of IIS Express.出现此问题是因为 Visual Studio 运行 32 位版本的 IIS Express。 The only way I could get it to work was to run the 64-bit IIS Express by executing the following command manually.我让它工作的唯一方法是通过手动执行以下命令来运行 64 位 IIS Express。

"C:\Program Files\IIS Express\iisexpress.exe"  /config:"U:\IISExpress\config\applicationhost.config"  /site:"Imaging.Web" /apppool:"Clr4IntegratedAppPool"

Then in your Visual Studio web project go to Properties, select "Use Custom Web Server", and enter the url to your site.然后在您的 Visual Studio Web 项目中,转到“属性”,选择“使用自定义 Web 服务器”,然后输入您站点的 url。

In order to Debug, go to debug > Attach to Process.. and then select your running IIS Express instance.要进行调试,请转到调试 > 附加到进程...,然后选择正在运行的 IIS Express 实例。

The Visual Studio team really should make this an option in the Project Properties. Visual Studio 团队确实应该将其作为项目属性中的一个选项。

-为您的网站创建一个新的 IIS 池 -为此池启用 32 位

Localization project on Asp.Net with C# Asp.Net 上的 C# 本地化项目

Project was working fine on Local Machine.项目在本地机器上运行良好。 After uploading on IIS and Web Server, it did not worked and Could not load file or assembly 'App_global.asax' or one of its dependencies.在 IIS 和 Web 服务器上上传后,它不起作用并且无法加载文件或程序集“App_global.asax”或其依赖项之一。 This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.此程序集由比当前加载的运行时更新的运行时构建,无法加载。 was coming.来了。

在此处输入图片说明

After changing Application Pool to V4.0 from v2.0 on IIS, the error got resolved.在 IIS 上将应用程序池从 v2.0 更改为 V4.0 后,错误得到解决。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何修复“无法加载文件或程序集“Spss”或其依赖项之一。 试图加载格式不正确的程序。'? - How I can fix 'Could not load file or assembly 'Spss' or one of its dependencies. An attempt was made to load a program with an incorrect format.'? 无法加载文件或程序集或其依赖项之一。 试图加载格式错误的程序 - Could not load file or assembly or one of its dependencies. An attempt was made to load a program with an incorrect format 无法加载文件或程序集“ MWArray”或其依赖项之一。 试图加载格式错误的程序 - Could not load file or assembly 'MWArray' or one of its dependencies. An attempt was made to load a program with an incorrect format 无法加载文件或程序集“ Interop.MODI”或其依赖项之一。 试图加载格式错误的程序 - Could not load file or assembly 'Interop.MODI' or one of its dependencies. An attempt was made to load a program with an incorrect format 无法加载文件或程序集“Oracle.DataAccess”或其依赖项之一。 试图加载格式不正确的程序 - Could not load file or assembly 'Oracle.DataAccess' or one of its dependencies. An attempt was made to load a program with an incorrect format 无法加载文件或程序集“ System.Data.SQLite”或其依赖项之一。 试图加载格式错误的程序 - Could not load file or assembly 'System.Data.SQLite' or one of its dependencies. An attempt was made to load a program with an incorrect format 无法加载文件或程序集“ Microsoft.Threading.Tasks.Extensions.Desktop”或其依赖项之一。 参数不正确 - Could not load file or assembly 'Microsoft.Threading.Tasks.Extensions.Desktop' or one of its dependencies. The parameter is incorrect 无法加载文件或程序集“AxInterop.WMPLib”或其依赖项之一。 参数不正确。 - Could not load file or assembly 'AxInterop.WMPLib' or one of its dependencies. The parameter is incorrect. 无法加载文件或程序集“ xxxLib”或其依赖项之一。 BadImageFormatException - Could not load file or assembly 'xxxLib' or one of its dependencies. BadImageFormatException 无法加载文件或程序集...尝试加载格式不正确的程序 - Could not load file or assembly... An attempt was made to load a program with an incorrect format
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM