asp.net-mvc – ASP MVC.NET3本地IIS7对象引用错误
在开发mvc Web应用程序期间,我正在鼓励运行本地站点实例的问题.当我尝试重新加载页面时,在第一次加载成功后,我看到了以下错误.如果我通过VS虚拟服务器运行该站点,则没有问题.我的应用程序池正在以集成模式运行,它正在运行.net 4.知道为什么会这样吗?这个信息足够吗?
MenuHelper用于构建导航菜单.失败的代码是if之外的return语句: private static string GenerateUrl(string url) { if (instance == null) { // hack to enable using this on old web forms pages return UrlHelper.GenerateContentUrl(url,new HttpContextWrapper(HttpContext.Current)); } return (new UrlHelper(instance.htmlHelper.ViewContext.RequestContext)).Content(url); } private static string GenerateUrl(string actionName,string controllerName) { if (instance == null) { // hack to enable using this on old web forms pages return GenerateUrl(String.Format("{0}/{1}",controllerName,actionName)); } if (instance.htmlHelper == null) throw new InvalidOperationException("htmlHelper has not been populated."); if (instance.htmlHelper.ViewContext == null) throw new InvalidOperationException("ViewContext has not been populated."); if (instance.htmlHelper.ViewContext.RequestContext == null) throw new InvalidOperationException("RequestContext has not been populated."); UrlHelper urlHelper = new UrlHelper(instance.htmlHelper.ViewContext.RequestContext); if (urlHelper == null) throw new InvalidOperationException("UrlHelper has not been populated."); if (String.IsNullOrEmpty(actionName)) throw new InvalidOperationException("actionName has not been populated."); if (String.IsNullOrEmpty(controllerName)) throw new InvalidOperationException("controllerName has not been populated."); return (urlHelper.Action(actionName,controllerName)); } 解决方法
我发现了这个问题,它是IIS7 URL重写模块.我不知道为什么或如何,但我通过卸载解决了这个问题.
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- 来自asp.net服务器端的确认框
- asp.net – WCF服务支持文件jsdebug无法加载
- 哪个表现最好:经典ASP,ASP.NET WebForms还是ASP.NET MVC?
- asp.net-mvc – 注册到global.asax的路由的替代位置
- asp.net-mvc-2 – ASP.NET MVC 2 Area文件夹中有什么和不属
- asp.net – 使用Html.EditorFor生成具有特定行数和列数的te
- 如何将TextBox双向绑定到ASP.NET中的代码隐藏属性?
- 使用SWFUpload无刷新上传图片
- .net – 使用Model First方法时如何种子数据?
- 在ASP.NET MVC中创建全局对象的最佳位置