我有一个混合了Web表单的MVC 3应用程序,其中包含许多“ascx”部分视图。该应用程序是预编译的,没有“可更新”的内容。因此,没有用于cshtml的占位符标记和ascx局部视图的Views文件夹。一切都工作正常,直到我们最近将应用程序更新为MVC 5.更新后,看起来应用程序不再找到“ascx”视图,除非您为每个用户控件创建一个虚拟占位符标记。否则您将获得以下异常:
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: The partial view '~/Views/Home/_PartialAscx.ascx' was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/Home/_PartialAscx.ascx
请注意,CSHTML部分视图仍然像魅力一样。我唯一的问题是ASCX视图。
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
对此问题的任何建议都将受到高度赞赏。