无法加载文件或程序集' PSCUWebService'或其中一个依赖项。尝试加载格式不正确的程序

时间:2015-07-02 17:25:20

标签: c# .net web-services .net-assembly

在尝试调试Web服务时,我收到以下错误:"无法加载文件或程序集' PSCUWebService'或其中一个依赖项。尝试加载格式不正确的程序"。我在64位计算机上使用VS2012。

我检查了配置管理器,项目有多种平台(x86,任何CPU,一个有x64)。我把它们改成了所有人说'任何CPU'那不起作用。

我还在PSCUWebService项目的属性及其所有依赖项中检查了Platform目标。 PSCUWebService的平台目标是' x64'并且它的所有依赖都有“任何CPU”#。我更改了PSCUWebService以说“任何CPU'”,重建,并尝试仅执行以接收不同的错误。

我不确定如何解决这个问题。考虑到我所做的研究,我很确定它与其中一个组件的位数有关。任何帮助将不胜感激。

这里是装配跟踪以及堆栈跟踪,以防万一有人看到我没有看到的东西:

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable  C:\Program Files (x86)\Common Files\Microsoft Shared\DevServer\11.0\WebDev.WebServer40.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: DisplayName = PSCUWebService
 (Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: PSCUWebService | Domain ID: 9
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/Users/cbenoit/workspace/PscuNet/Main/Plugins/PSCUWebService/
LOG: Initial PrivatePath = C:\Users\cbenoit\workspace\PscuNet\Main\Plugins\PSCUWebService\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\cbenoit\workspace\PscuNet\Main\Plugins\PSCUWebService\web.config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Users/cbenoit/AppData/Local/Temp/Temporary ASP.NET Files/root/149a454d/99c8d3c8/PSCUWebService.DLL.
LOG: Attempting download of new URL file:///C:/Users/cbenoit/AppData/Local/Temp/Temporary ASP.NET Files/root/149a454d/99c8d3c8/PSCUWebService/PSCUWebService.DLL.
LOG: Attempting download of new URL file:///C:/Users/cbenoit/workspace/PscuNet/Main/Plugins/PSCUWebService/bin/PSCUWebService.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.

和....

[BadImageFormatException: Could not load file or assembly 'PSCUWebService' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
   System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
   System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +34
   System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +152
   System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +77
   System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +16
   System.Reflection.Assembly.Load(String assemblyString) +28
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +38

[ConfigurationErrorsException: Could not load file or assembly 'PSCUWebService' 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) +752
   System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +218
   System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +130
   System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +170
   System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +91
   System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +285
   System.Web.Compilation.BuildManager.ExecutePreAppStart() +153
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +516

[HttpException (0x80004005): Could not load file or assembly 'PSCUWebService' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9913572
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
   System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +456

感谢!!!

0 个答案:

没有答案