加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net – 无法将“ASP._Page__ViewStart_cshtml”类型的对象强

发布时间:2020-12-16 07:15:57 所属栏目:asp.Net 来源:网络整理
导读:我正在为学校做一个项目.当我尝试将站点地图添加到我的网站时,会出现该错误. 堆栈跟踪: [InvalidCastException: Unable to cast object of type 'ASP._Page__ViewStart_cshtml' to type 'System.Web.WebPages.StartPage'.]System.Web.WebPages.StartPage.Ge
我正在为学校做一个项目.当我尝试将站点地图添加到我的网站时,会出现该错误.

堆栈跟踪:

[InvalidCastException: Unable to cast object of type 'ASP._Page__ViewStart_cshtml' to type 'System.Web.WebPages.StartPage'.]
System.Web.WebPages.StartPage.GetStartPage(WebPageRenderingBase page,String fileName,IEnumerable`1 supportedExtensions) +250
System.Web.Mvc.RazorView.RenderView(ViewContext viewContext,TextWriter writer,Object instance) +162
System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext,TextWriter writer) +115
System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +303
System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext,ActionResult actionResult) +13
System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +23
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter,ResultExecutingContext preContext,Func`1 continuation) +260
System.Web.Mvc.<>c__DisplayClass1e.<InvokeActionResultWithFilters>b__1b() +19
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext,IList`1 filters,ActionResult actionResult) +177
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext,String actionName) +343
System.Web.Mvc.Controller.ExecuteCore() +116
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +97
System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +37
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21
System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +50
System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7
System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8841105
System.Web.HttpApplication.ExecuteStep(IExecutionStep step,Boolean& completedSynchronously) +184

我试图撤消更改,并重建项目,但我仍然得到此错误.我在最后一次构建时有一个备份,当我解开时的代码和来自备份的代码是相同的,但备份代码不会给我错误.这是一个错误吗?
(我的英语不好,对不起)

解决方法

我不知道,如果这对你有所帮助,但当我将_ViewStart.cshtml从Views文件夹移到我项目的根文件夹时,我偶然发现了同样的问题.也许你偶然做了同样的事情?

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读