Lou*_*yen 4 urlhelper asp.net-mvc-5
我正在尝试为我的ASP.NET MVC 5.1应用程序创建单元测试.
我想使用UrlHelper.Action()方法验证传出的URL.我可以使用ASP.NET MVC 4,但不能使用ASP.NET MVC 5.1.
调用Action()方法时有一个异常:
System.Web.dll中发生了未处理的"System.NotImplementedException"类型异常
附加信息:未实现方法或操作.
请帮我解决一下!谢谢
我遇到了同样的问题.在我的情况下,NotImplementedException来自HttpContextBase.GetService.
以下代码解决了这个问题:
public override object GetService(Type serviceType)
{
return DependencyResolver.Current.GetService(serviceType);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
552 次 |
| 最近记录: |