ServiceLocator尚未初始化;我试图检索SharpArch.Core.CommonValidator.IValidator 描述:执行当前Web请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。
异常详细信息:System.NullReferenceException:ServiceLocator尚未初始化;我试图检索SharpArch.Core.CommonValidator.IValidator
来源错误:
在执行当前Web请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪来识别有关异常的起源和位置的信息。
堆栈追踪:
[NullReferenceException:ServiceLocator尚未初始化;我试图检索SharpArch.Core.CommonValidator.IValidator] C:\ MyStuff \ Projects \ SharpArchGitHub \ src \ SharpArch \ SharpArch.Core \ SafeServiceLocator.cs中的SharpArch.Core.SafeServiceLocator`1.GetService():20 C:\ MyStuff \ Projects \ SharpArchGitHub \ src \ SharpArch \ SharpArch.Core \ DomainModel \ ValidatableObject.cs中的SharpArch.Core.DomainModel.ValidatableObject.get_Validator():20 C:\ MyStuff \ Projects \ SharpArchGitHub \ src \ SharpArch \ SharpArch.Core \ DomainModel \ ValidatableObject.cs中的SharpArch.Core.DomainModel.ValidatableObject.ValidationResults():15 SharpArch.Web.ModelBinder.SharpModelBinder.OnModelUpdated(ControllerContext controllerContext,ModelBindingContext bindingContext)在C:\ MyStuff \ Projects \ SharpArchGitHub \ src \ SharpArch \ SharpArch.Web \ ModelBinder \ SharpModelBinder.cs:40 System.Web.Mvc.DefaultModelBinder.BindComplexElementalModel(ControllerContext controllerContext,ModelBindingContext bindingContext,Object model)+304 System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext controllerContext,ModelBindingContext bindingContext)+772 System.Web.Mvc.DefaultModelBinder.BindModel(ControllerContext controllerContext,ModelBindingContext bindingContext)+345 SharpArch.Web.ModelBinder.SharpModelBinder.BindModel(ControllerContext controllerContext,ModelBindingContext bindingContext)在C:\ MyStuff \ Projects \ SharpArchGitHub \ src \ SharpArch \ SharpArch.Web \ ModelBinder \ SharpModelBinder.cs:241 System.Web.Mvc.ControllerActionInvoker.GetParameterValue(ControllerContext controllerContext,ParameterDescriptor parameterDescriptor)+219 System.Web.Mvc.ControllerActionInvoker.GetParameterValues(ControllerContext controllerContext,ActionDescriptor actionDescriptor)+109 System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext,String actionName)+399 System.Web.Mvc.Controller.ExecuteCore()+ 126 System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext)+27 System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext)+7 System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase httpContext)+151 System.Web.Mvc.MvcHandler.ProcessRequest(HttpContext httpContext)+57 System.Web.Mvc.MvcHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext httpContext)+7 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()+ 181 System.Web.HttpApplication.ExecuteStep(IExecutionStep step,Boolean& completedSynchronously)+75
答案 0 :(得分:0)
自从我查看S#arp架构框架以来已经有一段时间了,但我的猜测是你缺少一些初始化例程来设置它的IOC容器。如果我没记错的话,S#arp支持多个IOC容器,它们包含在ServiceLocator中。
您是否尝试在S#arp Architecture mailing list上发布问题?