Asp.net mvc 从GIT部署Azure网站时出错
我正在尝试在Windows Azure网站上部署ASP.NET MVC5应用程序,但在我的git推送中不断出现此错误:Asp.net mvc 从GIT部署Azure网站时出错,asp.net-mvc,azure,azure-web-app-service,kudu,Asp.net Mvc,Azure,Azure Web App Service,Kudu,我正在尝试在Windows Azure网站上部署ASP.NET MVC5应用程序,但在我的git推送中不断出现此错误: 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\Fra
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 restore,我还有另一个MVC4应用程序,可以很好地部署 为了帮助识别问题,我建议从本地机器上的回购协议的干净克隆开始。然后运行NuGet restore,并检查.csproj中的所有相对引用是否都可以解析。看起来它试图回到GAC,这通常发生在相对路径混乱的时候。我认为你有更大的问题。它正在寻找
WebPages.razor2.0.0
,但是MVC5使用WebPages.razor3.0.0.0
,我认为版本5.0.0.0
适用于System.Web.Http.WebHost
。在不了解更多信息的情况下,这看起来像是一个升级到MVC 5的应用程序,可能错过了一些DLL或web.config到较新版本的映射。嗨,David。项目在我的本地计算机上成功编译。问题出在部署时。在阅读了Tommy的答案后,我意识到我混合了MVC4和MVC5,并用所有正确的引用从头开始创建了一个新项目。现在工作很好:)