【问题标题】:Error Deploying Azure Website from GIT从 GIT 部署 Azure 网站时出错
【发布时间】:2014-02-10 22:40:25
【问题描述】:

我正在尝试在 Windows Azure 网站上部署 ASP.NET MVC5 应用程序,但在我的 git push 上不断收到此错误:

All packages listed in packages.config are already installed.

Trex.Web.Common -> D:\home\site\repository\src\Trex.Web.Common\bin\Release\Trex.Web.Common.dll

D:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [D:\home\site\repository\src\Trex.Web.Admin\Trex.Web.Admin.csproj]

D:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [D:\home\site\repository\src\Trex.Web.Admin\Trex.Web.Admin.csproj]

App_Start\RouteConfig.cs(28,13): error CS1928: 'System.Web.Routing.RouteCollection' does not contain a definition for 'MapHttpRoute' and the best extension method overload 'System.Web.Http.HttpRouteCollectionExtensions.MapHttpRoute(System.Web.Http.HttpRouteCollection, string, string, object)' has some invalid arguments [D:\home\site\repository\src\Trex.Web.Admin\Trex.Web.Admin.csproj]

App_Start\RouteConfig.cs(28,13): error CS1929: Instance argument: cannot convert from 'System.Web.Routing.RouteCollection' to 'System.Web.Http.HttpRouteCollection' [D:\home\site\repository\src\Trex.Web.Admin\Trex.Web.Admin.csproj]
App_Start\RouteConfig.cs(34,13): error CS1928: 'System.Web.Routing.RouteCollection' does not contain a definition for 'MapHttpRoute' and the best extension method overload 'System.Web.Http.HttpRouteCollectionExtensions.MapHttpRoute(System.Web.Http.HttpRouteCollection, string, string, object)' has some invalid arguments [D:\home\site\repository\src\Trex.Web.Admin\Trex.Web.Admin.csproj]

App_Start\RouteConfig.cs(34,13): error CS1929: Instance argument: cannot convert from 'System.Web.Routing.RouteCollection' to 'System.Web.Http.HttpRouteCollection' [D:\home\site\repository\src\Trex.Web.Admin\Trex.Web.Admin.csproj]
App_Start\TrexAppSetup.cs(112,13): error CS0103: The name 'GlobalConfiguration' does not exist in the current context [D:\home\site\repository\src\Trex.Web.Admin\Trex.Web.Admin.csproj]
Failed exitCode=1, command="D:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" "D:\home\site\repository\src\Trex.Web.

Admin\Trex.Web.Admin.csproj" /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="C:\DWASFiles\Sites\credli-web-admin-staging\Temp\b5bff328-3b38-49b7-afab-8064f800112f";AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release /p:SolutionDir="D:\home\site\repository\src\\"
An error has occurred during web site deployment.

我已启用 nuget 还原,并且我有另一个部署良好的 MVC4 应用程序。

【问题讨论】:

  • 我认为你有更大的问题。它正在寻找WebPages.Razor 2.0.0.0,但是MVC 5 使用WebPages.Razor 3.0.0.0,我认为System.Web.Http.WebHost 的版本是5.0.0.0。在不了解更多信息的情况下,这看起来像是您升级到 MVC 5 的应用程序,并且可能遗漏了一些 Dll 或 web.config 到较新版本的映射。

标签: asp.net-mvc azure azure-web-app-service kudu


【解决方案1】:

为了帮助识别问题,我建议从本地计算机上的 repo 的干净克隆开始。然后运行 ​​NuGet 还原,并检查 .csproj 中的所有相关引用是否都可以解析。看起来它正试图退回到 GAC,这通常发生在相对路径混乱时。

【讨论】:

  • 嗨,大卫。该项目在我的本地机器上成功编译。问题出在部署时。在阅读了 Tommy 的回答后,我意识到我混合了 MVC4 和 MVC5,并且刚刚从头开始创建了一个包含所有正确引用的新项目。现在工作得很好:)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-10-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多