与stackoverflow上发布的this问题类似的问题,尽管我将其发布到Windows Server 2008 x64 SP2。
我最近从x86机器升级到x64(开发)。对我的MVC应用程序进行了一些更改,将其重新上传到上面提到的服务器,并得到了下面提到的错误。我没有以任何方式更改配置文件,实际上我所做的只是更改了一些HTML和JavaScript,重新编译并上传它。我怀疑与我在新的开发机器上重新编译它的事实有什么关系?不知道我怎么能解决这个问题。
注意:有问题的程序集确实存在于 bin 文件夹中,并且还明确设置为“copy local”。
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0234: The type or namespace name 'Html' does not exist in the namespace 'System.Web.Mvc' (are you missing an assembly reference?)
Source Error:
Line 40: <add namespace="System.Web.Mvc" />
Line 41: <add namespace="System.Web.Mvc.Ajax" />
Line 42: <add namespace="System.Web.Mvc.Html" />
Line 43: <add namespace="System.Web.Optimization" />
Line 44: <add namespace="System.Web.Routing" />
Source File: c:\inetpub\wwwroot\Heliosphere\Web.config Line: 42
Show Detailed Compiler Output:
C:\Windows\SysWOW64\inetsrv> "C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe" /t:library /utf8output /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Data.DataSetExtensions\v4.0_4.0.0.0__b77a5c561934e089\System.Data.DataSetExtensions.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\904c6749\773dc9\assembly\dl3\e93e1c9f\b98b1573_f50ece01\System.Web.WebPages.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\904c6749\773dc9\assembly\dl3\b748353d\837d0a72_f50ece01\Microsoft.Web.Infrastructure.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_32\System.Web\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.Extensions\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.Extensions.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Activities\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Activities.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.Services\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.Services.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\904c6749\773dc9\assembly\dl3\45f37046\60cecf72_f50ece01\System.Web.Helpers.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.ApplicationServices\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.ApplicationServices.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\904c6749\773dc9\assembly\dl3\a622ef58\e3226374_f50ece01\System.Web.Http.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\904c6749\773dc9\assembly\dl3\8400f0b1\ff3e4e72_f50ece01\Newtonsoft.Json.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Activities\v4.0_4.0.0.0__31bf3856ad364e35\System.Activities.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\904c6749\773dc9\assembly\dl3\97b97546\ab470067_f50ece01\EntityFramework.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\904c6749\773dc9\assembly\dl3\09c804a0\24ca3407_6eb1cd01\System.Threading.Tasks.Dataflow.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\904c6749\773dc9\assembly\dl3\3745d18d\1addb99b_d025ce01\Heliosphere.Web.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.Serialization\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\904c6749\773dc9\assembly\dl3\06f8d1b0\c362ac74_f50ece01\System.Web.Http.WebHost.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel\v4.0_4.0.0.0__b77a5c561934e089\System.ServiceModel.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Activation\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Activation.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\904c6749\773dc9\assembly\dl3\9194cd87\76c6aa75_f50ece01\System.Web.Optimization.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\904c6749\773dc9\assembly\dl3\c795b16a\9b58f275_f50ece01\Antlr3.Runtime.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Web\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Web.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_32\System.EnterpriseServices\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\904c6749\773dc9\assembly\dl3\3b840423\32024717_ce25ce01\Heliosphere.AccessService.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ComponentModel.DataAnnotations\v4.0_4.0.0.0__31bf3856ad364e35\System.ComponentModel.DataAnnotations.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\904c6749\773dc9\assembly\dl3\2305b33a\5efdfdaf_0825ce01\Telstra.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.WorkflowServices\v4.0_4.0.0.0__31bf3856ad364e35\System.WorkflowServices.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.IdentityModel\v4.0_4.0.0.0__b77a5c561934e089\System.IdentityModel.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\904c6749\773dc9\assembly\dl3\01bfab33\0c260176_f50ece01\WebGrease.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\904c6749\773dc9\assembly\dl3\4c5a83e9\0d88f172_f50ece01\System.Web.WebPages.Deployment.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_32\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\904c6749\773dc9\assembly\dl3\02c0255b\aefdca73_f50ece01\System.Net.Http.Formatting.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml.Linq\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.Linq.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\904c6749\773dc9\assembly\dl3\8516d5c4\5cd48a72_f50ece01\System.Web.Razor.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\904c6749\773dc9\assembly\dl3\47ee1890\6fab2273_f50ece01\System.Web.WebPages.Razor.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.CSharp\v4.0_4.0.0.0__b03f5f7f11d50a3a\Microsoft.CSharp.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\904c6749\773dc9\assembly\dl3\5bbddb12\00677eaa_9e8ecd01\Microsoft.Exchange.WebServices.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.DynamicData\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.DynamicData.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\904c6749\773dc9\assembly\dl3\b69a7fa8\0e2c1275_f50ece01\System.Web.Providers.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\904c6749\773dc9\assembly\dl3\3c0808a8\1c17df16_ce25ce01\Heliosphere.Model.dll" /out:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\904c6749\773dc9\App_global.asax.ilahar0n.dll" /debug- /optimize+ /w:4 /nowarn:1659;1699;1701;612;618 /warnaserror- "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\904c6749\773dc9\App_global.asax.ilahar0n.0.cs" "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\904c6749\773dc9\App_global.asax.ilahar0n.1.cs"
Microsoft (R) Visual C# Compiler version 4.0.30319.17929
for Microsoft (R) .NET Framework 4.5
Copyright (C) Microsoft Corporation. All rights reserved.
c:\inetpub\wwwroot\Heliosphere\Web.config(42,26): error CS0234: The type or namespace name 'Html' does not exist in the namespace 'System.Web.Mvc' (are you missing an assembly reference?)
c:\inetpub\wwwroot\Heliosphere\Web.config(41,26): error CS0234: The type or namespace name 'Ajax' does not exist in the namespace 'System.Web.Mvc' (are you missing an assembly reference?)
答案 0 :(得分:1)
我遇到了同样的问题,只需将System.Web.Mvc.dll的属性设置为Copy Local = true。
答案 1 :(得分:0)
通过重新创建应用程序并重建它来解决问题。
我认为它是应用程序构建配置中的引用。我没有足够的时间去挖掘。