我正在尝试运行我在Visual 2012中创建的WCF服务。
我在这一页的错误下面。
异常详细信息: System.BadImageFormatException:无法加载文件>或程序集'dllname‘或其依赖项之一。尝试以不正确的格式加载程序。>程序集加载跟踪:以下信息有助于>确定程序集'dllname‘无法加载的原因。> ===预绑定状态信息===日志: User =DefaultAppPool\DefaultAppPool日志: DisplayName = dllname (部分) WRN:>为程序集提供了部分绑定信息: WRN:>程序集名称: dllname \ Domain :2 WRN:当提供了>部分程序集显示名称时会发生部分绑定。WRN:这可能>导致绑定程序加载不正确的程序集。WRN:建议为>程序集WRN:提供一个完整指定的文本标识,该标识由简单名称、版本、区域性和>公钥令牌组成。WRN:有关此问题的更多信息和>常见解决方案,请参见白皮书> http://go.microsoft.com/fwlink/?LinkId=109270。LOG: Appbase => file:///D:/wwwroot/website/WebServices/ LOG:初始PrivatePath =>D:\wwwroot\#en0#\WebServices\bin调用程序集:(未知)。> ===日志:此绑定在默认加载上下文中启动。日志:使用应用程序配置文件:> D:\wwwroot\website\WebServices\web.config日志:使用主机>配置文件:> C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.日志:使用>机器配置文件> LOG:此时未应用于引用的策略(私有的、>自定义的、部分的或基于位置的程序集绑定)。日志:尝试>下载新URL > file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary > ASP.NET Files/webservices/febcb7de/76686d13/dllname.DLL.日志:>尝试下载新URL > file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary > ASP.NET Files/webservices/febcb7de/76686d13/dllname/dllname.DLL.日志:>尝试下载新URL > file:///D:/wwwroot/website/WebServices/bin/dllname.DLL. ERR:未能>完成程序集的设置(hr = 0x8007000b)。探测结束了。>堆栈跟踪:>> BadImageFormatException:无法加载文件或程序集'dllname‘或>其依赖项之一。尝试以>不正确的格式加载程序.> System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName、String > codeBase、Evidence、RuntimeAssembly locationHint、> StackCrawlMark& stackMark、IntPtr pPrivHostBinder、布尔值> throwOnFileNotFound、布尔值forIntrospection、布尔值> suppressSecurityChecks) + IntPtr fileName、String > codeBase、locationHint、codeBase、> StackCrawlMark& assemblySecurity、en21#、Boolean >、Boolean、Boolean >en24#) +34 >#en2>、证据、en28#、> StackCrawlMark&、en31#、布尔#32#、布尔,+15 2> System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString,>凭证assemblySecurity,StackCrawlMark& stackMark,IntPtr > pPrivHostBinder,布尔forIntrospection) +77 >suppressSecurityChecks assemblyString,> Evidence,StackCrawlMark& stackMark,Boolean > forIntrospection) +16 System.Reflection.Assembly.Load(String > assemblyString) +28 > System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String > assemblyName,Boolean ) +38 > Could >stackMark:无法加载文件或程序集Could>dllname‘或其依赖项之一。尝试以不正确的格式加载>程序.> System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String > assemblyName,布尔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) +258 > System.Web.Compilation.BuildManager.ExecutePreAppStart() +135 > System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager > appManager,IApplicationHost appHost,IConfigMapPathFactory > configMapPathFactory,HostingEnvironmentParameters hostingParameters,> PolicyLevel policyLevel,异常appDomainCreationException) +516 >> HttpException (0x80004005):无法加载文件或程序集'dllname‘>或其依赖项之一。尝试以>不正确的格式加载程序。> System.Web.HttpRuntime.FirstRequestInit(HttpContext上下文) +9873784 > System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext上下文)>+101个System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest > wr,HttpContext上下文) +254 >
我在谷歌上搜索过,我已经尝试过几种方法了。1)在应用程序池中启用32位应用程序2)使项目属性中的目标成为“任意CPU”3)删除临时文件、回收应用程序池、重置IIS等。
如果你有更多的建议,请帮忙。
发布于 2013-05-31 17:54:21
看起来,您正在尝试将64位程序集加载到32位应用程序池中。我这么说是因为我在堆栈跟踪中看到了C:\Windows\Microsoft.NET\Framework\v4.0.30319\。如果是64位应用程序池,它将使用Framework64。禁用“启用32位”,然后重试。
https://stackoverflow.com/questions/16862928
复制相似问题