简体   繁体   English

将MVC5 Web应用程序部署到远程服务器时出现问题

[英]Issues deploying MVC5 web app to remote server

I have a web app that runs just fine on my local machine. 我有一个可以在本地计算机上正常运行的Web应用程序。 It was an MVC 3 web app that I just recently moved to MVC 5 Now when I deployed it to the remove VPS, I get this error. 这是一个MVC 3 Web应用程序,我最近才移至MVC5。现在,当我将其部署到删除的VPS时,出现此错误。

System.Web.WebPages.Razor, Version=1.0.0.0 should not be used anywhere. System.Web.WebPages.Razor,版本= 1.0.0.0不应在任何地方使用。 Why am I getting this error? 为什么会出现此错误?

All config files should be using 3.0.0.0 The target fremework is 4.5. 所有配置文件都应使用3.0.0.0。目标框架为4.5。 ASP.NET 4.5 installed on the VPS I haven't installed MVC5 on the remote VPS. VPS上安装了ASP.NET 4.5我没有在远程VPS上安装MVC5。

Are there any documentation on staps to follow to deploy MVC 5 to remote server? 是否有任何有关将MVC 5部署到远程服务器的步骤说明?

3960 3960

w3wp.exe 程序w3wp.exe

IIS APPPOOL\\Mysite IIS APPPOOL \\ Mysite

InvalidOperationException 出现InvalidOperationException

The pre-application start initialization method Start on type Microsoft.Web.Helpers.PreApplicationStartCode threw an exception with the following error message: Could not load file or assembly ' System.Web.WebPages.Razor, Version=1.0.0.0 , Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. 应用程序前的启动初始化方法Microsoft.Web.Helpers.PreApplicationStartCode类型上引发了带有以下错误消息的异常:无法加载文件或程序集' System.Web.WebPages.Razor,Version = 1.0.0.0 ,Culture = neutral ,PublicKeyToken = 31bf3856ad364e35'或其依赖项之一。 The located assembly's manifest definition does not match the assembly reference. 找到的程序集的清单定义与程序集引用不匹配。 (Exception from HRESULT: 0x80131040). (来自HRESULT的异常:0x80131040)。 at

System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection 1 methods, Func 1 setHostingEnvironmentCultures) at System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) at System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) at System.Web.Compilation.BuildManager.ExecutePreAppStart() at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) Could not load file or assembly ' System.Web.WebPages.Razor, Version=1.0.0.0 , Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. System.Web.Compilation.BuildManager.CallPreStartInitMethods(ICollection 1 methods, Func System.Web.Compilation.BuildManager.CallPreStartInitMethods(ICollection 1 methods, Func 1 setHostingEnvironmentCultures)(ICollection`1方法) )在System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager,IApplicationHost appHost,IConfigMapPathFactory configMapPathFactory,HostingEnvironmentParameters HostingParameters,PolicyLevel policyLevel,Exception appDomainCreationException)的System.Web.Compilation.BuildManager.ExecutePreAppStart()上无法加载文件或程序集' System .Web.WebPages.Razor,版本= 1.0.0.0 ,文化=中性,PublicKeyToken = 31bf3856ad364e35'或其依赖项之一。 The located assembly's manifest definition does not match the assembly reference. 找到的程序集的清单定义与程序集引用不匹配。 (Exception from HRESULT: 0x80131040) at Microsoft.Web.Helpers.PreApplicationStartCode.Start() (HRESULT的异常:0x80131040)Microsoft.Web.Helpers.PreApplicationStartCode.Start()

Add an assembly binding redirect in the web.config: 在web.config中添加程序集绑定重定向:

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
</runtime>

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM