在使用ASP.NET MVC 3的计算机上安装ASP.NET MVC 4 Beta后,我收到以下异常.
System.InvalidCastException未由用户代码处理Message = [A] System.Web.WebPages.Razor.Configuration.HostSection无法强制转换为[B] System.Web.WebPages.Razor.Configuration.HostSection.类型A源自'System.Web.WebPages.Razor,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35',位于'默认'位置'C:\ Windows\Microsoft.Net\assembly\GAC_MSIL\System .Web.WebPages.Razor\v4.0_1.0.0.0__31bf3856ad364e35\System.Web.WebPages.Razor.dll".\的Windows\Microsoft.Net \组件\ GAC_MSIL \系统:B型从 'System.Web.WebPages.Razor,版本= 2.0.0.0,文化=中性公钥= 31bf3856ad364e35' 在位置上下文 '默认'"C起源.Web.WebPages.Razor\v4.0_2.0.0.0__31bf3856ad364e35\System.Web.WebPages.Razor.dll".来源= System.Web.WebPages.Razor
堆栈跟踪:
位于System.Web.WebPages.Razor.Razor.RazorBuildProvider.GetHostFromConfig()的System.Web.WebPages.Razor.WebRazorHostFactory.CreateHostFromConfig(String virtualPath,String physicalPath)上的System.Web.WebPages.Razor.WebRazorHostFactory.GetRazorSection(String virtualPath)处系统.Web.WebPages.Razor.RazorBuildProvider.CreateHost()位于System.Web.WebPages.Razor.RazorBuildProvider.EnsureGeneratedCode(),System.Web.WebPages.Razor.RazorBuildProvider.get_CodeCompilerType()位于System.Web.Compilation.BuildProvider. System.Web.Compilation上的System.Web.Compilation.Build上的System.Web.Compilation.Build上的System.Web.Compilation.Build上的System.Web.Compilation.BuildProvidersCompiler.PerformBuild()的System.Web.Compilation.Build上的GetCompilerTypeFromBuildProvider(BuildProvider buildProvider)位于System.Web.Compilation上的System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath虚拟路径). BuildManager.GetVPathBuildResultInternal(virtualPath virtualPath,布尔noBuild,布尔allowCrossApp,布尔allowBuildInPrecompile,布尔throwIfNotFound,布尔ensureIsUpToDate)一 System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath,HttpContext context,Boolean)中的System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context,VirtualPath virtualPath,Boolean noBuild,Boolean allowCrossApp,Boolean allowBuildInPrecompile,Boolean throwIfNotFound,Boolean ensureIsUpToDate) System.Web.Mvc上System.Web.Mvc.BuildManagerViewEngine.FileExists(ControllerContext controllerContext,String virtualPath)上的System.Web.Mvc.BuildManagerWrapper.System.Web.Mvc.IBuildManager.FileExists(String virtualPath)中的allowCrossApp,Boolean throwIfNotFound System.Web.Mvc.VirtualPathProviderViewEngine.GetPath(ControllerContext controllerContext,String []位置,.VirtualPathProviderViewEngine.GetPathFromGeneralName(ControllerContext controllerContext,List`1位置,String name,String controllerName,String areaName,String cacheKey,String []&searchingLocations), String [] areaLocations,String locationsPropertyName,S 在System.Web.Mvc.ViewEngineCollection上的System.Web.Mvc.VirtualPathProviderViewEngine.FindView(ControllerContext controllerContext,String viewName,String masterName,Boolean useCache)中输入name,String controllerName,String cacheKeyPrefix,Boolean useCache,String []&searchingLocations).位于System.Web.Mvc.ViewEngineCollection.FindView(ControllerContext controllerContext,String viewName,String masterName)的System.Web.Mvc.ViewEngineCollection.Find(Func`2 lookup,Boolean trackSearchedPaths)上的<> c__DisplayClassc.b__b(IViewEngine …
我正在运行一个ASP.NET网页页面,在初始加载时从SQL服务器中提取项目列表.此查询在大约一秒钟内运行,并在2秒内加载页面.返回约1000条记录,给予或接受.我从Service Manager SQL数据库中提取Hostnames以及其他一些信息.
在这个页面中,我有一个内置的搜索,它基本上运行完全相同的查询,但使用基于主机名的LIKE运行它.这将加载包含搜索查询一部分的所有主机名的同一页面.查询通常在一秒钟内在SQL Management Studio中运行,但加载页面需要更长时间,有时会超时.
我的问题是,为什么基于参数的搜索需要更长的时间,有时会因为没有明显原因而超时.是否有任何步骤可以缓解此超时?以下是完整错误.
'/'应用程序中的服务器错误.
The wait operation timed out
Run Code Online (Sandbox Code Playgroud)
描述:执行当前Web请求期间发生未处理的异常.请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息.
例外细节:
System.ComponentModel.Win32Exception: The wait operation timed out
Source Error:
Line 13: }
Line 14:
Line 15: var selectedData = db.Query(selectCommand, searchTerm);
Line 16:
Line 17:
Source File: c:\Users\u0149920\Documents\My Web Sites\AppSupport\servers\default.cshtml Line: 15
Run Code Online (Sandbox Code Playgroud)
堆栈跟踪:
[Win32Exception (0x80004005): The wait operation timed out]
[SqlException (0x80131904): Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) …Run Code Online (Sandbox Code Playgroud) 将ASP.NET Web Helpers Library更新到今天显然已发布的2.0版后,会出现此错误.我错误地更新了,但是如果可能的话,现在想解决这个问题.
检测到的ASP.NET网页版本存在冲突:指定版本为"1.0.0.0",但bin中的版本为"2.0.0.0".要继续,请从应用程序的bin目录中删除文件,或删除web.config中的版本规范.
显然这是web.config中的问题:
<add key="webpages:Version" value="1.0.0.0" />
Run Code Online (Sandbox Code Playgroud)
有没有人甚至有关于这个ASP.NET Web Helpers Library包2.0的任何信息?我无法找到发行说明.Nuget网站上没什么.
安装microsoft web helper后出现以下错误:
检测到的ASP.NET网页版本存在冲突:指定版本为"1.0.0.0",但bin中的版本为"2.0.0.0".要继续,请从应用程序的bin目录中删除文件,或删除web.config中的版本规范.
从我读到的,我可能已经尝试安装错误的版本.但是我该怎么做呢?到目前为止,我有
但这些都没有(如网上建议的那样).请问如何解决这个问题.我已经在这几个小时了
尝试运行我的应用程序时出现MvcWebRazorHostFactory错误,但它根本不是MVC应用程序.我通过nuget安装了以下Web包:
Microsoft ASP.NET Razor
Microsoft ASP.NET Web API 2.1
Microsoft ASP.NET Web Pages
Run Code Online (Sandbox Code Playgroud)
我的应用程序是angularjs前端使用剃刀视图(.cshtml).我不明白为什么我一直收到这个错误.
An exception of type 'System.InvalidOperationException' occurred in System.Web.WebPages.Razor.dll but was not handled in user code
Additional information: Could not locate Razor Host Factory type: System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35
Run Code Online (Sandbox Code Playgroud)
这是我的web.config中的剃刀部分:
<system.web.webPages.razor>
<host factoryType="System.Web.WebPages.Razor.WebRazorHostFactory, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.WebPages.WebPage">
<namespaces>
<add namespace="System.Web.Configuration" />
<add namespace="System.Web.Optimization" />
<add namespace="System.Web.Routing" />
</namespaces>
</pages>
Run Code Online (Sandbox Code Playgroud)
我试图在VS2010中"构建"我的MVC3 Web应用程序但是不断收到以下错误:
错误2'c:\ Program Files(x86)\ Microsoft ASP.NET\ASP.NET MVC 3\Assemblies\System.Web.Mvc.dll'和'c'中存在类型'System.Web.Mvc.ModelClientValidationRule' :\ Program Files(x86)\ Microsoft ASP.NET\ASP.NET Web Pages\v2.0\Assemblies\System.Web.WebPages.dll'C:\ Users\brownp\Documents\Visual Studio 2010\Projects\Cab \驾驶室\型号\ AccountModels.cs 223 28驾驶室
此外,每次打开解决方案时,它都会提示我以下内容:

我通过Web Platform Installer安装并成功安装,但每次打开解决方案时都会重新显示该消息.
有人可以提供任何指导吗?
谢谢保罗
我有以下功能,我希望在我的asp.net网页2应用程序中可用于几个.cshtml视图.如何使该功能可用于应用程序中的任何视图(而不仅仅是一个).
@functions {
public bool DisplayButton(String startDate, String endDate)
{
return Convert.ToDateTime(startDate) < DateTime.Now && Convert.ToDateTime(endDate) > DateTime.Now;
}
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用我的通配符http处理程序来处理*.cshtml页面,但请求永远不会到达我的处理程序,因为它看起来像是被我发现通过此StackTrace存在的WebPageHttpModule拦截:
[HttpException (0x80004005): Exception of type 'System.Web.HttpException' was thrown.]
System.Web.WebPages.ApplicationStartPage.ExecuteStartPage(HttpApplication application, Action`1 monitorFile, Func`2 fileExists, Func`2 createInstance, IEnumerable`1 supportedExtensions) +88
System.Web.WebPages.ApplicationStartPage.ExecuteStartPage(HttpApplication application) +287
System.Web.WebPages.WebPageHttpModule.StartApplication(HttpApplication application, Action`1 executeStartPage, EventHandler applicationStart) +113
System.Web.WebPages.WebPageHttpModule.StartApplication(HttpApplication application) +71
System.Web.WebPages.WebPageHttpModule.Init(HttpApplication application) +156
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +431
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +194
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +339
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +253
[HttpException (0x80004005): Exception of type 'System.Web.HttpException' was thrown.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +8972180
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +97
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) …Run Code Online (Sandbox Code Playgroud) 当我在Visual Studio 11 Beta中打开包含MVC3项目的解决方案时,我看到以下消息:

Web项目"Landboss.Web"需要缺少与Visual Studio一起运行的Web组件.您是否要立即使用Web平台安装程序下载并安装它们?(注意:某些组件可能需要重新启动才能生效.)
使用Razor语法1.0.0.0的ASP.NET网页
单击" 是"时,Web平台安装程序将打开并告诉我:

到目前为止,我已经在两台机器上安装了Visual Studio 11 Beta,两者都有同样的问题.
web-platform-installer visual-studio razor asp.net-webpages asp.net-mvc-3
我有点心疼,要求另一个不能读取未定义问题的属性"长度",但没有任何在线(SE或其他)答案与我手头的问题有任何关系.
我已经尽力缩小为什么这个脚本错误发生在我的情况,但我不知所措.
如果我在页面中排除此标记,则错误将停止显示:
<script src="~/Plugins/jquery-ui-1.10.3.drag-drop.min.js" type="text/javascript"></script>
Run Code Online (Sandbox Code Playgroud)
该jquery-ui-1.10.3.drag-drop.min.js文件的所有内容都是jquery-custom我重命名的文件,其中包括jquery draggable,droppable和sortable.
我确信这个错误是由我编写的一些脚本引起的,但是当我刚刚开始测试它时,我没有太多的脚本要"注释掉",当我这样做时,它对我的困惑,没有摆脱错误.到目前为止,我发现摆脱错误的唯一方法是完全排除插件,如果我这样做,我显然无法使用.
Chrome调试器中显示的完整错误:
Uncaught TypeError: Cannot read property 'length' of undefined jquery-1.9.1.min.js:3
b.extend.each jquery-1.9.1.min.js:3
e.widget jquery-ui-1.10.3.drag-drop.min.js:6
(anonymous function) jquery-ui-1.10.3.drag-drop.min.js:6
(anonymous function) jquery-ui-1.10.3.drag-drop.min.js:6
Run Code Online (Sandbox Code Playgroud)
问题是(正如大多数这样的错误)我无法追查导致错误的原因,即使没有编写任何代码甚至还没有使用这个插件.
我正在使用jquery-1.9.1.min.js和jquery-migrate-1.2.1.min.js文件.
事实是,我可以忽略这个错误,因为它并没有真正破坏任何东西,拖放,丢弃和可排序的功能似乎都可以正常工作并且符合预期.我认为在你的页面中出现脚本错误很难看,而且我过去从未容忍过它们,我现在并不想开始容忍它们.
我吠叫错了树吗?错误是否指向我的拖放文件?我该怎么做才能帮助缩小此错误?
如果有更多我能提供的信息,请告诉我.
AS REQUESTED- <script>标签中显示的<head>标签:
<script src="~/Resources/jquery-1.9.1.min.js" type="text/javascript"></script>
<script src="~/Resources/jquery-migrate-1.2.1.min.js" type="text/javascript"></script>
<script src="~/Plugins/jquery.maskedinput.min.js" type="text/javascript"></script>
<script src="~/Plugins/jquery-ui.min.js" type="text/javascript"></script>
<script src="~/Plugins/accounting.min.js" type="text/javascript"></script>
<script src="~/Plugins/jquery.autoellipsis-1.0.10.min.js" type="text/javascript"></script>
<script src="~/Plugins/jquery-ui-1.10.3.drag-drop.min.js" type="text/javascript"></script>
<script src="~/Scripts/PluginConfigurations.js" type="text/javascript"></script>
<script src="~/Scripts/main.js" …Run Code Online (Sandbox Code Playgroud) asp.net-webpages ×10
razor ×6
asp.net ×5
asp.net-mvc ×5
web-config ×2
.net ×1
c# ×1
javascript ×1
jquery ×1
jquery-ui ×1