AppHarbor ServiceStack.Razor v4无法加载文件或程序集'xxx'

时间:2014-01-16 23:07:32

标签: appharbor servicestack-razor

我正在尝试在AppHarbor上托管ServiceStack Razor网站。该网站建立,但当我导航到该网站时,我得到以下错误

  

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

堆栈跟踪如下

  

[BadImageFormatException:无法加载文件或程序集'CfpPortal'或其依赖项之一。试图加载格式不正确的程序。]      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:无法加载文件或程序集'CfpPortal'或其依赖项之一。试图加载格式不正确的程序。]      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):无法加载文件或程序集“CfpPortal”或其依赖项之一。试图加载格式不正确的程序。]      System.Web.HttpRuntime.FirstRequestInit(HttpContext context)+9913572      System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context)+101      System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr,HttpContext context)+254

我的web.Config文件如下

 <?xml version="1.0" encoding="utf-8"?>
 <!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <configSections>
    <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
      <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
    </sectionGroup>
  </configSections>
  <!--
    For a description of web.config changes for .NET 4.5 see http://go.microsoft.com/fwlink/?LinkId=235367.

    The following attributes can be set on the <httpRuntime> tag.
      <system.Web>
        <httpRuntime targetFramework="4.5" />
      </system.Web>
  -->
  <system.web>
    <compilation targetFramework="4.5" debug="true">
      <assemblies>
        <add assembly="System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      </assemblies>
      <buildProviders>
        <add extension=".cshtml" type="ServiceStack.Razor.CSharpRazorBuildProvider, ServiceStack.Razor" />
      </buildProviders>
    </compilation>
    <httpRuntime />
    <pages controlRenderingCompatibilityVersion="4.0" />
    <customErrors mode="Off"/>
  </system.web>
  <system.webServer>
    <handlers>
      <add path="*" name="ServiceStack.Factory" type="ServiceStack.HttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" />
    </handlers>
  </system.webServer>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Data.SQLite" publicKeyToken="db937bc2d44ff139" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-1.0.90.0" newVersion="1.0.90.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <appSettings>
    <add key="webPages:Enabled" value="false" />
  </appSettings>
  <system.web.webPages.razor>
    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <pages pageBaseType="ServiceStack.Razor.ViewPage">
      <namespaces>
        <add namespace="ServiceStack" />
        <add namespace="ServiceStack.Html" />
        <add namespace="ServiceStack.Razor" />
        <add namespace="ServiceStack.Text" />
        <add namespace="ServiceStack.OrmLite" />
        <add namespace="CfpPortal" />
      </namespaces>
    </pages>
  </system.web.webPages.razor>
</configuration>

1 个答案:

答案 0 :(得分:0)

解决了这个问题,因为在解决方案级别我设置了为任何CPU构建的所有东西,但在项目级别我有一个为x64构建的项目。