【问题标题】:appharbor WCF Service assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded [closed]appharbor WCF 服务程序集由比当前加载的运行时更新的运行时构建,无法加载 [关闭]
【发布时间】:2013-08-05 21:56:49
【问题描述】:

当我尝试在 appharbor 中运行 WCF 服务时出现以下错误。我在本地机器上使用 .NET Framework 4 并且它工作正常。我在 appharbor 中禁用了预编译,以便在部署期间不会产生任何错误。因此,构建成功部署,没有任何错误。

“/”应用程序中的服务器错误。

无法加载文件或程序集“TnPServiceAH”或其依赖项之一。此程序集由比当前加载的运行时更新的运行时构建,无法加载。

说明:在执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。

异常详细信息:System.BadImageFormatException:无法加载文件或程序集“TnPServiceAH”或其依赖项之一。此程序集由比当前加载的运行时更新的运行时构建,无法加载。

来源错误:

在执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪来识别有关异常来源和位置的信息。

程序集加载跟踪:以下信息有助于确定程序集“TnPServiceAH”无法加载的原因。

警告:程序集绑定日志记录已关闭。 要启用程序集绑定失败日志记录,请将注册表值 [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) 设置为 1。 注意:有一些与程序集绑定失败日志相关的性能损失。 要关闭此功能,请删除注册表值 [HKLM\Software\Microsoft\Fusion!EnableLog]。

堆栈跟踪:

[BadImageFormatException:无法加载文件或程序集“TnPServiceAH”或其依赖项之一。此程序集由比当前加载的运行时更新的运行时构建,无法加载。] 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) +48 System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, 证据 assemblySecurity, StackCrawlMark& stackMark, Boolean for Introspection) +278 System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean for Introspection) +145 System.Reflection.Assembly.Load(String assemblyString) +28 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +46

[ConfigurationErrorsException:无法加载文件或程序集“TnPServiceAH”或其依赖项之一。此程序集由比当前加载的运行时更新的运行时构建,无法加载。] System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +590 System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +193 System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +45 System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +178 System.Web.Compilation.WebDirectoryBatchCompiler..ctor(VirtualDirectory vdir) +164 System.Web.Compilation.BuildManager.BatchCompileWebDirectoryInternal(VirtualDirectory vdir, Boolean ignoreErrors) +51 System.Web.Compilation.BuildManager.BatchCompileWebDirectory(VirtualDirectory vdir, VirtualPath virtualDir, Boolean ignoreErrors) +187 System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) +648 System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) +305 System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext 上下文,VirtualPath virtualPath,布尔 noBuild,布尔allowCrossApp,布尔allowBuildInPrecompile)+99 System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext 上下文,VirtualPath virtualPath,布尔 noBuild,布尔allowCrossApp,布尔allowBuildInPrecompile)+75 System.Web.Compilation.BuildManager.GetCompiledCustomString(String virtualPath) +28 System.ServiceModel.HostingManager.GetCompiledCustomString(String normalizedVirtualPath) +135 System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath) +26 System.ServiceModel.HostingManager.ActivateService(String normalizedVirtualPath) +43 System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) +495

[ServiceActivationException:服务'/TnPServiceAH.svc'由于编译过程中的异常而无法激活。异常消息是:无法加载文件或程序集“TnPServiceAH”或其依赖项之一。此程序集由比当前加载的运行时更新的运行时构建,无法加载..] System.ServiceModel.AsyncResult.End(IAsyncResult 结果) +394 System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult 结果) +196 System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(HttpApplication 上下文,布尔流上下文)+216 System.ServiceModel.Activation.HttpModule.ProcessRequest(对象发送者,EventArgs e)+271 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +128 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +168

版本信息:Microsoft .NET Framework 版本:2.0.50727.5472; ASP.NET 版本:2.0.50727.5471

【问题讨论】:

  • App Harbor 有支持论坛,看起来这个更适合那里。
  • @oleksii:该网站表示,可以在此处发布在 App Harbor 类型的问题中运行应用程序的一般问题,以便更快、更准确地回复。让我也将其发布在支持论坛中。谢谢。

标签: c# .net wcf c#-4.0 appharbor


【解决方案1】:

我通过 App Harbor Support 得到了答案。 App Harbor 通过“targetFramework”属性的存在和值来检测 ASP.NET 4.0,因此配置文件 (web.config) 应包含以下内容:

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

【讨论】:

    【解决方案2】:

    看起来您在要部署到的机器上的 IIS 下的网站配置中设置了错误的 ASP.Net 版本。打开 IIS 管理器并确保为应用配置的 ASP.Net 版本为 4.0。在较旧的 Windows 版本下,您为每个应用设置此设置,在较新的版本(我认为是 2008 年及更高版本)下,它是按应用程序池完成的。

    【讨论】:

    • 是的,我知道这个程序,感谢您的提醒。但我不知道是否允许我访问 App Harbor 的 IIS。让我看看吧。
    猜你喜欢
    • 2011-09-15
    • 1970-01-01
    • 2012-08-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-12-03
    相关资源
    最近更新 更多