MVC 编译错误,在临时 ASP.NET 文件中使用 WebApplication1
MVC Compilation Error, using WebApplication1 in Temporary ASP.NET Files
我今天遇到了这个奇怪的错误,显然我无法解决它。
我已经创建了一个完整的 ASP.NET API,它工作得很好,没有问题。现在我想向应用程序添加一些 MVC 页面。 ASP.NET API 自动给你一个控制器,(家庭控制器)默认 asp.net 页面。
现在,当我尝试打开此页面时,我浏览到 http://localhost:26264/home。
首先我得到了 System.Web.MVC 参考的错误:
Could not load file or assembly 'System.Web.Mvc, Version=5.2.2.0...
我通过转到 nuget 管理器并更新 MVC 解决了这个问题,MVC 将其更新为 5.2.3.0
版本,如我的 web.config 文件(如下)所述。
现在我在浏览同一地址时遇到另一个错误。
我收到一个编译错误:
说明:编译服务此请求所需的资源期间发生错误。请查看以下特定错误详细信息并适当修改您的源代码。
Compiler Error Message: CS0246: The type or namespace name 'WebApplication1' could not be found (are you missing a using directive or an assembly reference?)
Source Error:
Line 26: using System.Web.Optimization;
Line 27: using System.Web.Routing;
Line 28: using WebApplication1;
Line 29:
Line 30:
Source File: c:\Users\%USERNAME%\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\App_Web_index.cshtml.a8d08dba.t8kfgnmp.0.cs Line: 28
- 我的应用程序名称是 而不是 WebApplication1。
- 重建失败,
- 删除临时文件夹无效。
- 删除 debug、release 和 bin 文件夹无效。
- 我在我的项目参考或 web.config 文件中找不到它。
- 正在从解决方案中删除任何不再使用的项目。
- 运行 在我的笔记本电脑上,我从来没有编译过项目,给出了同样的错误。
- 其他新创建的 mvc 应用程序可以工作。
我遍历了每个 .cs 文件,但没有使用它。
就像我说的,其余的运行正常,但我无法打开任何 MVC 页面,即使创建一个空页面也是如此。
我唯一能想到的是它应该是有版本的,就像我最初用 MVC 得到的那样。因为我已经从网站下载了这个 API 的模板(用于 API 中正确的外部登录行为)。所以该项目的日期是 13-07-2014。
我的 Web.Config 文件:
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework"
type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
requirePermission="false"/>
</configSections>
<connectionStrings>
<add name="AuthContext"
connectionString="some database"
providerName="System.Data.SqlClient"/>
</connectionStrings>
<appSettings>
<add key="webpages:Version" value="3.0.0.0"/>
<add key="webpages:Enabled" value="false"/>
<add key="ClientValidationEnabled" value="true"/>
<add key="UnobtrusiveJavaScriptEnabled" value="true"/>
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5"/>
<httpRuntime targetFramework="4.5"/>
<machineKey validationKey="confidential I guess"
decryptionKey="confidential I guess" validation="SHA1" decryption="AES"/>
</system.web>
<system.webServer>
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0"/>
<remove name="OPTIONSVerbHandler"/>
<remove name="TRACEVerbHandler"/>
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler"
preCondition="integratedMode,runtimeVersionv4.0"/>
</handlers>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-5.1.0.0" newVersion="5.1.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-5.1.0.0" newVersion="5.1.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856sad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"/>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
</providers>
</entityFramework>
</configuration>
显示详细的编译器输出:
C:\Program Files (x86)\IIS Express> "C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe" /t:library /utf8output /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\assembly\GAC_MSIL\Microsoft.CSharp\v4.0_4.0.0.0__b03f5f7f11d50a3a\Microsoft.CSharp.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\assembly\GAC_MSIL\System.Activities\v4.0_4.0.0.0__31bf3856ad364e35\System.Activities.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\assembly\GAC_MSIL\System.Xml.Linq\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.Linq.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.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.Data.DataSetExtensions\v4.0_4.0.0.0__b77a5c561934e089\System.Data.DataSetExtensions.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3a25be8[=13=]298484_2fe1cf01\EntityFramework.SqlServer.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3\e4e456f0a7fc09_c7a6d001\System.Web.WebPages.Deployment.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.VisualStudio.Web.PageInspector.Loader\v4.0_1.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Web.PageInspector.Loader.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3e13637a[=13=]64da67_6c98d001\WebGrease.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl36b9ea4bf1a60_6c98d001\System.Web.Optimization.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3\b004c4ba[=13=]298484_2fe1cf01\Microsoft.AspNet.Identity.Core.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\assembly\GAC_MSIL\System.ServiceModel\v4.0_4.0.0.0__b77a5c561934e089\System.ServiceModel.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3\d053c54a[=13=]298484_2fe1cf01\Microsoft.AspNet.Identity.EntityFramework.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:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3\c00cea1f[=13=]298484_2fe1cf01\EntityFramework.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3a259b50a7fc09_c7a6d001\System.Web.Helpers.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.Web.Infrastructure\v4.0_1.0.0.0__31bf3856ad364e35\Microsoft.Web.Infrastructure.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl37894d0a7fc09_c7a6d001\System.Web.WebPages.Razor.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\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3b891fac[=13=]298484_2fe1cf01\Owin.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:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3287057[=13=]298484_2fe1cf01\Microsoft.Owin.Host.SystemWeb.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:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3e3324b2[=13=]298484_2fe1cf01\Microsoft.AspNet.Identity.Owin.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3\f5e62a40[=13=]37a966_6c98d001\Antlr3.Runtime.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3\df949ad9[=13=]298484_2fe1cf01\System.Web.Http.Owin.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:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3de213fd[=13=]298484_2fe1cf01\System.Web.Http.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3\b76d5c10[=13=]298484_2fe1cf01\System.Web.Cors.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3\e4698f0d[=13=]298484_2fe1cf01\Microsoft.Owin.Security.Cookies.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_32\System.EnterpriseServices\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3f17822[=13=]db2a40_2c8ed001\Microsoft.Owin.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl32af3eda7fc09_c7a6d001\System.Web.Mvc.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.Runtime.Serialization\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3706741a7fc09_c7a6d001\System.Web.WebPages.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:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3\d26ced0e[=13=]db2a40_2c8ed001\Microsoft.Owin.Security.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3c6c055271c340_2c8ed001\Microsoft.Owin.Security.Facebook.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages.Deployment\v4.0_2.0.0.0__31bf3856ad364e35\System.Web.WebPages.Deployment.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_32\System.Web\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3\bbcc5165a7fc09_c7a6d001\System.Web.Razor.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3[=13=]be6b9ea[=13=]298484_2fe1cf01\Microsoft.Owin.Security.OAuth.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\App_global.asax.wzkby3d1.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3153ac5[=13=]298484_2fe1cf01\System.Net.Http.Formatting.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3b61974[=13=]298484_2fe1cf01\Microsoft.Owin.Cors.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl35618f0[=13=]db2a40_2c8ed001\Newtonsoft.Json.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl342251efa56e65_d0a6d001\AngularJSAuthentication.API.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3b74cb952b946_2c8ed001\Microsoft.Owin.Security.Google.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3\c5202dd8[=13=]298484_2fe1cf01\System.Web.Http.WebHost.dll" /out:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\App_Web_index.cshtml.6373d792.i9ntk24m.dll" /D:DEBUG /debug+ /optimize- /w:4 /nowarn:1659;1699;1701;612;618 /warnaserror- "C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\App_Web_index.cshtml.6373d792.i9ntk24m.0.cs" "C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\App_Web_index.cshtml.6373d792.i9ntk24m.1.cs"
Microsoft (R) Visual C# Compiler version 4.0.30319.18408
for Microsoft (R) .NET Framework 4.5
Copyright (C) Microsoft Corporation. All rights reserved.
c:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\App_Web_index.cshtml.6373d792.i9ntk24m.0.cs(28,11): error CS0246: The type or namespace name 'WebApplication1' could not be found (are you missing a using directive or an assembly reference?)
源文件有点长,如果对您有帮助:
#pragma checksum "[pathToProject]\AngularJSAuthentication\AngularJSAuthentication.API\Views\home\Index.cshtml" "{ff1816ec-a...."
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18444
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ASP {
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Helpers;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using System.Web.Mvc.Html;
using System.Web.Optimization;
using System.Web.Routing;
using WebApplication1;
public class _Page_Views_home_Index_cshtml : System.Web.Mvc.WebViewPage<dynamic> {
#line hidden
public _Page_Views_home_Index_cshtml() {
}
protected ASP.global_asax ApplicationInstance {
get {
return ((ASP.global_asax)(Context.ApplicationInstance));
}
}
public override void Execute() {
BeginContext("~/Views/home/Index.cshtml", 0, 4, true);
WriteLiteral("<div");
EndContext("~/Views/home/Index.cshtml", 0, 4, true);
BeginContext("~/Views/home/Index.cshtml", 4, 18, true);
WriteLiteral(" class=\"jumbotron\"");
EndContext("~/Views/home/Index.cshtml", 4, 18, true);
BeginContext("~/Views/home/Index.cshtml", 22, 31, true);
WriteLiteral(">\r\n <h1>ASP.NET</h1>\r\n <p");
EndContext("~/Views/home/Index.cshtml", 22, 31, true);
BeginContext("~/Views/home/Index.cshtml", 53, 13, true);
WriteLiteral(" class=\"lead\"");
EndContext("~/Views/home/Index.cshtml", 53, 13, true);
BeginContext("~/Views/home/Index.cshtml", 66, 130, true);
WriteLiteral(">ASP.NET is a free web framework for building great Web sites and Web application" +
"s using HTML, CSS, and JavaScript.</p>\r\n <p><a");
EndContext("~/Views/home/Index.cshtml", 66, 130, true);
BeginContext("~/Views/home/Index.cshtml", 196, 22, true);
WriteLiteral(" href=\"http://asp.net\"");
EndContext("~/Views/home/Index.cshtml", 196, 22, true);
BeginContext("~/Views/home/Index.cshtml", 218, 31, true);
WriteLiteral(" class=\"btn btn-primary btn-lg\"");
EndContext("~/Views/home/Index.cshtml", 218, 31, true);
BeginContext("~/Views/home/Index.cshtml", 249, 41, true);
WriteLiteral(">Learn more »</a></p>\r\n</div>\r\n<div");
EndContext("~/Views/home/Index.cshtml", 249, 41, true);
BeginContext("~/Views/home/Index.cshtml", 290, 12, true);
WriteLiteral(" class=\"row\"");
EndContext("~/Views/home/Index.cshtml", 290, 12, true);
BeginContext("~/Views/home/Index.cshtml", 302, 11, true);
WriteLiteral(">\r\n <div");
EndContext("~/Views/home/Index.cshtml", 302, 11, true);
BeginContext("~/Views/home/Index.cshtml", 313, 17, true);
WriteLiteral(" class=\"col-md-4\"");
EndContext("~/Views/home/Index.cshtml", 313, 17, true);
BeginContext("~/Views/home/Index.cshtml", 330, 359, true);
WriteLiteral(@">
<h2>Getting started</h2>
<p>
ASP.NET Web API is a framework that makes it easy to build HTTP services that reach
a broad range of clients, including browsers and mobile devices. ASP.NET Web API
is an ideal platform for building RESTful applications on the .NET Framework.
</p>
<p><a");
EndContext("~/Views/home/Index.cshtml", 330, 359, true);
BeginContext("~/Views/home/Index.cshtml", 689, 24, true);
WriteLiteral(" class=\"btn btn-default\"");
EndContext("~/Views/home/Index.cshtml", 689, 24, true);
BeginContext("~/Views/home/Index.cshtml", 713, 53, true);
WriteLiteral(" href=\"http://go.microsoft.com/fwlink/?LinkId=301870\"");
EndContext("~/Views/home/Index.cshtml", 713, 53, true);
BeginContext("~/Views/home/Index.cshtml", 766, 49, true);
WriteLiteral(">Learn more »</a></p>\r\n </div>\r\n <div");
EndContext("~/Views/home/Index.cshtml", 766, 49, true);
BeginContext("~/Views/home/Index.cshtml", 815, 17, true);
WriteLiteral(" class=\"col-md-4\"");
EndContext("~/Views/home/Index.cshtml", 815, 17, true);
BeginContext("~/Views/home/Index.cshtml", 832, 202, true);
WriteLiteral(">\r\n <h2>Get more libraries</h2>\r\n <p>NuGet is a free Visual Studio " +
"extension that makes it easy to add, remove, and update libraries and tools in V" +
"isual Studio projects.</p>\r\n <p><a");
EndContext("~/Views/home/Index.cshtml", 832, 202, true);
BeginContext("~/Views/home/Index.cshtml", 1034, 24, true);
WriteLiteral(" class=\"btn btn-default\"");
EndContext("~/Views/home/Index.cshtml", 1034, 24, true);
BeginContext("~/Views/home/Index.cshtml", 1058, 53, true);
WriteLiteral(" href=\"http://go.microsoft.com/fwlink/?LinkId=301871\"");
EndContext("~/Views/home/Index.cshtml", 1058, 53, true);
BeginContext("~/Views/home/Index.cshtml", 1111, 49, true);
WriteLiteral(">Learn more »</a></p>\r\n </div>\r\n <div");
EndContext("~/Views/home/Index.cshtml", 1111, 49, true);
BeginContext("~/Views/home/Index.cshtml", 1160, 17, true);
WriteLiteral(" class=\"col-md-4\"");
EndContext("~/Views/home/Index.cshtml", 1160, 17, true);
BeginContext("~/Views/home/Index.cshtml", 1177, 175, true);
WriteLiteral(">\r\n <h2>Web Hosting</h2>\r\n <p>You can easily find a web hosting com" +
"pany that offers the right mix of features and price for your applications.</p>\r" +
"\n <p><a");
EndContext("~/Views/home/Index.cshtml", 1177, 175, true);
BeginContext("~/Views/home/Index.cshtml", 1352, 24, true);
WriteLiteral(" class=\"btn btn-default\"");
EndContext("~/Views/home/Index.cshtml", 1352, 24, true);
BeginContext("~/Views/home/Index.cshtml", 1376, 53, true);
WriteLiteral(" href=\"http://go.microsoft.com/fwlink/?LinkId=301872\"");
EndContext("~/Views/home/Index.cshtml", 1376, 53, true);
BeginContext("~/Views/home/Index.cshtml", 1429, 51, true);
WriteLiteral(">Learn more »</a></p>\r\n </div>\r\n</div>\r\n\r\n");
EndContext("~/Views/home/Index.cshtml", 1429, 51, true);
}
}
}
在搭建脚手架时,添加第一个视图似乎出了点问题。我没有检查View文件夹中的web.config文件,结果发现添加了一个命名空间,名为WebApplication1。我不知道我是怎么做到的,但是在删除它之后,一切又恢复正常了。
因此,如果您遇到此类错误,请检查所有 Web.Config 文件。
编辑 web.config 解决了这个问题,也有同样的问题,必须在我的 web.config 中进行更改才能修复问题。
我今天遇到了这个奇怪的错误,显然我无法解决它。 我已经创建了一个完整的 ASP.NET API,它工作得很好,没有问题。现在我想向应用程序添加一些 MVC 页面。 ASP.NET API 自动给你一个控制器,(家庭控制器)默认 asp.net 页面。
现在,当我尝试打开此页面时,我浏览到 http://localhost:26264/home。
首先我得到了 System.Web.MVC 参考的错误:
Could not load file or assembly 'System.Web.Mvc, Version=5.2.2.0...
我通过转到 nuget 管理器并更新 MVC 解决了这个问题,MVC 将其更新为 5.2.3.0
版本,如我的 web.config 文件(如下)所述。
现在我在浏览同一地址时遇到另一个错误。 我收到一个编译错误:
说明:编译服务此请求所需的资源期间发生错误。请查看以下特定错误详细信息并适当修改您的源代码。
Compiler Error Message: CS0246: The type or namespace name 'WebApplication1' could not be found (are you missing a using directive or an assembly reference?)
Source Error:
Line 26: using System.Web.Optimization;
Line 27: using System.Web.Routing;
Line 28: using WebApplication1;
Line 29:
Line 30:
Source File: c:\Users\%USERNAME%\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\App_Web_index.cshtml.a8d08dba.t8kfgnmp.0.cs Line: 28
- 我的应用程序名称是 而不是 WebApplication1。
- 重建失败,
- 删除临时文件夹无效。
- 删除 debug、release 和 bin 文件夹无效。
- 我在我的项目参考或 web.config 文件中找不到它。
- 正在从解决方案中删除任何不再使用的项目。
- 运行 在我的笔记本电脑上,我从来没有编译过项目,给出了同样的错误。
- 其他新创建的 mvc 应用程序可以工作。
我遍历了每个 .cs 文件,但没有使用它。
就像我说的,其余的运行正常,但我无法打开任何 MVC 页面,即使创建一个空页面也是如此。
我唯一能想到的是它应该是有版本的,就像我最初用 MVC 得到的那样。因为我已经从网站下载了这个 API 的模板(用于 API 中正确的外部登录行为)。所以该项目的日期是 13-07-2014。
我的 Web.Config 文件:
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework"
type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
requirePermission="false"/>
</configSections>
<connectionStrings>
<add name="AuthContext"
connectionString="some database"
providerName="System.Data.SqlClient"/>
</connectionStrings>
<appSettings>
<add key="webpages:Version" value="3.0.0.0"/>
<add key="webpages:Enabled" value="false"/>
<add key="ClientValidationEnabled" value="true"/>
<add key="UnobtrusiveJavaScriptEnabled" value="true"/>
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5"/>
<httpRuntime targetFramework="4.5"/>
<machineKey validationKey="confidential I guess"
decryptionKey="confidential I guess" validation="SHA1" decryption="AES"/>
</system.web>
<system.webServer>
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0"/>
<remove name="OPTIONSVerbHandler"/>
<remove name="TRACEVerbHandler"/>
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler"
preCondition="integratedMode,runtimeVersionv4.0"/>
</handlers>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-5.1.0.0" newVersion="5.1.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-5.1.0.0" newVersion="5.1.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856sad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"/>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
</providers>
</entityFramework>
</configuration>
显示详细的编译器输出:
C:\Program Files (x86)\IIS Express> "C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe" /t:library /utf8output /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\assembly\GAC_MSIL\Microsoft.CSharp\v4.0_4.0.0.0__b03f5f7f11d50a3a\Microsoft.CSharp.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\assembly\GAC_MSIL\System.Activities\v4.0_4.0.0.0__31bf3856ad364e35\System.Activities.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\assembly\GAC_MSIL\System.Xml.Linq\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.Linq.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.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.Data.DataSetExtensions\v4.0_4.0.0.0__b77a5c561934e089\System.Data.DataSetExtensions.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3a25be8[=13=]298484_2fe1cf01\EntityFramework.SqlServer.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3\e4e456f0a7fc09_c7a6d001\System.Web.WebPages.Deployment.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.VisualStudio.Web.PageInspector.Loader\v4.0_1.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Web.PageInspector.Loader.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3e13637a[=13=]64da67_6c98d001\WebGrease.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl36b9ea4bf1a60_6c98d001\System.Web.Optimization.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3\b004c4ba[=13=]298484_2fe1cf01\Microsoft.AspNet.Identity.Core.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\assembly\GAC_MSIL\System.ServiceModel\v4.0_4.0.0.0__b77a5c561934e089\System.ServiceModel.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3\d053c54a[=13=]298484_2fe1cf01\Microsoft.AspNet.Identity.EntityFramework.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:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3\c00cea1f[=13=]298484_2fe1cf01\EntityFramework.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3a259b50a7fc09_c7a6d001\System.Web.Helpers.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.Web.Infrastructure\v4.0_1.0.0.0__31bf3856ad364e35\Microsoft.Web.Infrastructure.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl37894d0a7fc09_c7a6d001\System.Web.WebPages.Razor.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\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3b891fac[=13=]298484_2fe1cf01\Owin.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:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3287057[=13=]298484_2fe1cf01\Microsoft.Owin.Host.SystemWeb.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:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3e3324b2[=13=]298484_2fe1cf01\Microsoft.AspNet.Identity.Owin.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3\f5e62a40[=13=]37a966_6c98d001\Antlr3.Runtime.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3\df949ad9[=13=]298484_2fe1cf01\System.Web.Http.Owin.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:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3de213fd[=13=]298484_2fe1cf01\System.Web.Http.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3\b76d5c10[=13=]298484_2fe1cf01\System.Web.Cors.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3\e4698f0d[=13=]298484_2fe1cf01\Microsoft.Owin.Security.Cookies.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_32\System.EnterpriseServices\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3f17822[=13=]db2a40_2c8ed001\Microsoft.Owin.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl32af3eda7fc09_c7a6d001\System.Web.Mvc.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.Runtime.Serialization\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3706741a7fc09_c7a6d001\System.Web.WebPages.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:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3\d26ced0e[=13=]db2a40_2c8ed001\Microsoft.Owin.Security.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3c6c055271c340_2c8ed001\Microsoft.Owin.Security.Facebook.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages.Deployment\v4.0_2.0.0.0__31bf3856ad364e35\System.Web.WebPages.Deployment.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_32\System.Web\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3\bbcc5165a7fc09_c7a6d001\System.Web.Razor.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3[=13=]be6b9ea[=13=]298484_2fe1cf01\Microsoft.Owin.Security.OAuth.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\App_global.asax.wzkby3d1.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3153ac5[=13=]298484_2fe1cf01\System.Net.Http.Formatting.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3b61974[=13=]298484_2fe1cf01\Microsoft.Owin.Cors.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl35618f0[=13=]db2a40_2c8ed001\Newtonsoft.Json.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl342251efa56e65_d0a6d001\AngularJSAuthentication.API.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3b74cb952b946_2c8ed001\Microsoft.Owin.Security.Google.dll" /R:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\assembly\dl3\c5202dd8[=13=]298484_2fe1cf01\System.Web.Http.WebHost.dll" /out:"C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\App_Web_index.cshtml.6373d792.i9ntk24m.dll" /D:DEBUG /debug+ /optimize- /w:4 /nowarn:1659;1699;1701;612;618 /warnaserror- "C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\App_Web_index.cshtml.6373d792.i9ntk24m.0.cs" "C:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\App_Web_index.cshtml.6373d792.i9ntk24m.1.cs"
Microsoft (R) Visual C# Compiler version 4.0.30319.18408
for Microsoft (R) .NET Framework 4.5
Copyright (C) Microsoft Corporation. All rights reserved.
c:\Users\Ruud\AppData\Local\Temp\Temporary ASP.NET Files\rootca8dc5ac0d57\App_Web_index.cshtml.6373d792.i9ntk24m.0.cs(28,11): error CS0246: The type or namespace name 'WebApplication1' could not be found (are you missing a using directive or an assembly reference?)
源文件有点长,如果对您有帮助:
#pragma checksum "[pathToProject]\AngularJSAuthentication\AngularJSAuthentication.API\Views\home\Index.cshtml" "{ff1816ec-a...."
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18444
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ASP {
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Helpers;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using System.Web.Mvc.Html;
using System.Web.Optimization;
using System.Web.Routing;
using WebApplication1;
public class _Page_Views_home_Index_cshtml : System.Web.Mvc.WebViewPage<dynamic> {
#line hidden
public _Page_Views_home_Index_cshtml() {
}
protected ASP.global_asax ApplicationInstance {
get {
return ((ASP.global_asax)(Context.ApplicationInstance));
}
}
public override void Execute() {
BeginContext("~/Views/home/Index.cshtml", 0, 4, true);
WriteLiteral("<div");
EndContext("~/Views/home/Index.cshtml", 0, 4, true);
BeginContext("~/Views/home/Index.cshtml", 4, 18, true);
WriteLiteral(" class=\"jumbotron\"");
EndContext("~/Views/home/Index.cshtml", 4, 18, true);
BeginContext("~/Views/home/Index.cshtml", 22, 31, true);
WriteLiteral(">\r\n <h1>ASP.NET</h1>\r\n <p");
EndContext("~/Views/home/Index.cshtml", 22, 31, true);
BeginContext("~/Views/home/Index.cshtml", 53, 13, true);
WriteLiteral(" class=\"lead\"");
EndContext("~/Views/home/Index.cshtml", 53, 13, true);
BeginContext("~/Views/home/Index.cshtml", 66, 130, true);
WriteLiteral(">ASP.NET is a free web framework for building great Web sites and Web application" +
"s using HTML, CSS, and JavaScript.</p>\r\n <p><a");
EndContext("~/Views/home/Index.cshtml", 66, 130, true);
BeginContext("~/Views/home/Index.cshtml", 196, 22, true);
WriteLiteral(" href=\"http://asp.net\"");
EndContext("~/Views/home/Index.cshtml", 196, 22, true);
BeginContext("~/Views/home/Index.cshtml", 218, 31, true);
WriteLiteral(" class=\"btn btn-primary btn-lg\"");
EndContext("~/Views/home/Index.cshtml", 218, 31, true);
BeginContext("~/Views/home/Index.cshtml", 249, 41, true);
WriteLiteral(">Learn more »</a></p>\r\n</div>\r\n<div");
EndContext("~/Views/home/Index.cshtml", 249, 41, true);
BeginContext("~/Views/home/Index.cshtml", 290, 12, true);
WriteLiteral(" class=\"row\"");
EndContext("~/Views/home/Index.cshtml", 290, 12, true);
BeginContext("~/Views/home/Index.cshtml", 302, 11, true);
WriteLiteral(">\r\n <div");
EndContext("~/Views/home/Index.cshtml", 302, 11, true);
BeginContext("~/Views/home/Index.cshtml", 313, 17, true);
WriteLiteral(" class=\"col-md-4\"");
EndContext("~/Views/home/Index.cshtml", 313, 17, true);
BeginContext("~/Views/home/Index.cshtml", 330, 359, true);
WriteLiteral(@">
<h2>Getting started</h2>
<p>
ASP.NET Web API is a framework that makes it easy to build HTTP services that reach
a broad range of clients, including browsers and mobile devices. ASP.NET Web API
is an ideal platform for building RESTful applications on the .NET Framework.
</p>
<p><a");
EndContext("~/Views/home/Index.cshtml", 330, 359, true);
BeginContext("~/Views/home/Index.cshtml", 689, 24, true);
WriteLiteral(" class=\"btn btn-default\"");
EndContext("~/Views/home/Index.cshtml", 689, 24, true);
BeginContext("~/Views/home/Index.cshtml", 713, 53, true);
WriteLiteral(" href=\"http://go.microsoft.com/fwlink/?LinkId=301870\"");
EndContext("~/Views/home/Index.cshtml", 713, 53, true);
BeginContext("~/Views/home/Index.cshtml", 766, 49, true);
WriteLiteral(">Learn more »</a></p>\r\n </div>\r\n <div");
EndContext("~/Views/home/Index.cshtml", 766, 49, true);
BeginContext("~/Views/home/Index.cshtml", 815, 17, true);
WriteLiteral(" class=\"col-md-4\"");
EndContext("~/Views/home/Index.cshtml", 815, 17, true);
BeginContext("~/Views/home/Index.cshtml", 832, 202, true);
WriteLiteral(">\r\n <h2>Get more libraries</h2>\r\n <p>NuGet is a free Visual Studio " +
"extension that makes it easy to add, remove, and update libraries and tools in V" +
"isual Studio projects.</p>\r\n <p><a");
EndContext("~/Views/home/Index.cshtml", 832, 202, true);
BeginContext("~/Views/home/Index.cshtml", 1034, 24, true);
WriteLiteral(" class=\"btn btn-default\"");
EndContext("~/Views/home/Index.cshtml", 1034, 24, true);
BeginContext("~/Views/home/Index.cshtml", 1058, 53, true);
WriteLiteral(" href=\"http://go.microsoft.com/fwlink/?LinkId=301871\"");
EndContext("~/Views/home/Index.cshtml", 1058, 53, true);
BeginContext("~/Views/home/Index.cshtml", 1111, 49, true);
WriteLiteral(">Learn more »</a></p>\r\n </div>\r\n <div");
EndContext("~/Views/home/Index.cshtml", 1111, 49, true);
BeginContext("~/Views/home/Index.cshtml", 1160, 17, true);
WriteLiteral(" class=\"col-md-4\"");
EndContext("~/Views/home/Index.cshtml", 1160, 17, true);
BeginContext("~/Views/home/Index.cshtml", 1177, 175, true);
WriteLiteral(">\r\n <h2>Web Hosting</h2>\r\n <p>You can easily find a web hosting com" +
"pany that offers the right mix of features and price for your applications.</p>\r" +
"\n <p><a");
EndContext("~/Views/home/Index.cshtml", 1177, 175, true);
BeginContext("~/Views/home/Index.cshtml", 1352, 24, true);
WriteLiteral(" class=\"btn btn-default\"");
EndContext("~/Views/home/Index.cshtml", 1352, 24, true);
BeginContext("~/Views/home/Index.cshtml", 1376, 53, true);
WriteLiteral(" href=\"http://go.microsoft.com/fwlink/?LinkId=301872\"");
EndContext("~/Views/home/Index.cshtml", 1376, 53, true);
BeginContext("~/Views/home/Index.cshtml", 1429, 51, true);
WriteLiteral(">Learn more »</a></p>\r\n </div>\r\n</div>\r\n\r\n");
EndContext("~/Views/home/Index.cshtml", 1429, 51, true);
}
}
}
在搭建脚手架时,添加第一个视图似乎出了点问题。我没有检查View文件夹中的web.config文件,结果发现添加了一个命名空间,名为WebApplication1。我不知道我是怎么做到的,但是在删除它之后,一切又恢复正常了。
因此,如果您遇到此类错误,请检查所有 Web.Config 文件。
编辑 web.config 解决了这个问题,也有同样的问题,必须在我的 web.config 中进行更改才能修复问题。