错误System.Web.HttpCompileException(0x80004005)

时间:2012-10-16 13:23:24

标签: asp.net-mvc asp.net-mvc-3 runtime-error

我现在突然只在一页中收到以下消息。可能是什么问题?

我正在使用MVC ASP .NET做一个网站。

  

System.Web.HttpCompileException(0x80004005):   c:\ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ Temporary ASP.NET   文件\根\ fcd5a636 \ 19fe4d1 \ App_Web_create.cshtml.c6727781.9mayykrj.0.cs(162):   错误CS1528:预期;或=(不能指定构造函数参数   声明)在System.Web.Compilation.AssemblyBuilder.Compile()at   System.Web.Compilation.BuildProvidersCompiler.PerformBuild()at   System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath   virtualPath)at   System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath   virtualPath,Boolean noBuild,Boolean allowCrossApp,Boolean   allowBuildInPrecompile,Boolean throwIfNotFound,Boolean   保证在最近的时候   System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext的   context,VirtualPath virtualPath,Boolean noBuild,Boolean   allowCrossApp,Boolean allowBuildInPrecompile,Boolean   throwIfNotFound,Boolean ensureIsUpToDate)at   System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath   virtualPath,HttpContext context,Boolean allowCrossApp,Boolean   throwIfNotFound)at   System.Web.Compilation.BuildManager.GetObjectFactory(字符串   virtualPath,Boolean throwIfNotFound)at   System.Web.Mvc.BuildManagerWrapper.System.Web.Mvc.IBuildManager.FileExists(字符串   virtualPath)at   System.Web.Mvc.BuildManagerViewEngine.FileExists(ControllerContext   controllerContext,String virtualPath)at   System.Web.Mvc.VirtualPathProviderViewEngine.GetPathFromGeneralName(ControllerContext   controllerContext,List 1 locations, String name, String controllerName, String areaName, String cacheKey, String[]& searchedLocations) at System.Web.Mvc.VirtualPathProviderViewEngine.GetPath(ControllerContext controllerContext, String[] locations, String[] areaLocations, String locationsPropertyName, String name, String controllerName, String cacheKeyPrefix, Boolean useCache, String[]& searchedLocations) at System.Web.Mvc.VirtualPathProviderViewEngine.FindView(ControllerContext controllerContext, String viewName, String masterName, Boolean useCache) at System.Web.Mvc.ViewEngineCollection.<>c__DisplayClassc.<FindView>b__b(IViewEngine e) at System.Web.Mvc.ViewEngineCollection.Find(Func 2 lookup,Boolean   trackSearchedPaths)at   System.Web.Mvc.ViewEngineCollection.FindView(ControllerContext   controllerContext,String viewName,String masterName)at   System.Web.Mvc.ViewResult.FindView(ControllerContext context)at   System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)   在   System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext   controllerContext,ActionResult actionResult)at   System.Web.Mvc.ControllerActionInvoker&LT;&GT; C_ DisplayClass1c.b _19()   在   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter   filter,ResultExecutingContext preContext,Func 1 continuation) at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1c.<>c__DisplayClass1e.<InvokeActionResultWithFilters>b__1b() at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList 1个过滤器,ActionResult actionResult)at   System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext   controllerContext,String actionName)at   System.Web.Mvc.Controller.ExecuteCore()at   System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext)   在   System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(的RequestContext   requestContext)at   System.Web.Mvc.MvcHandler&LT;&GT; C_ DisplayClass6&LT;。&以及c _DisplayClassb.b_ 5()   在   System.Web.Mvc.Async.AsyncResultWrapper&LT;。&以及c _DisplayClass1.b_ 0()   在   System.Web.Mvc.Async.AsyncResultWrapper。&lt;&gt; c _DisplayClass8 1.<BeginSynchronous>b__7(IAsyncResult _) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult 1.End()at   System.Web.Mvc.MvcHandler&LT;&GT; C_ DisplayClasse.b _d()   在System.Web.Mvc.SecurityUtil.b__0(行动f)   在System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult)   asyncResult)at   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult的   结果)在   System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()   在System.Web.HttpApplication.ExecuteStep(IExecutionStep步骤,   布尔和放大器; completedSynchronously)

1 个答案:

答案 0 :(得分:3)

这个错误意味着:预期;或=(不能在声明中指定构造函数参数)

形成对类的引用,就好像正在创建类的对象一样。例如,尝试将变量传递给构造函数。使用new运算符创建类的对象。

以下示例生成CS1528:

// CS1528.cs
using System;

public class B
{
   public B(int i)
   {
      _i = i;
   }

   public void PrintB()
   {
      Console.WriteLine(_i);
   }

   private int _i;
}

public class mine
{
   public static void Main()
   {
      B b(3);   // CS1528, reference is not an object
      // try one of the following
      // B b;
      // or
      // B bb = new B(3);
      // bb.PrintB();
   }
}

希望这会有所帮助。 Source