ServiceLocator尚未初始化;我试图检索 SharpArch.Core.CommonValidator.IValidator
“/”应用程序中的服务器错误。
ServiceLocator尚未初始化;我试图检索 SharpArch.Core.CommonValidator.IValidator 描述:执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其在代码中的来源的更多信息。
异常详细信息:System.NullReferenceException:ServiceLocator 尚未初始化;我试图检索 SharpArch.Core.CommonValidator.IValidator
源错误:
在执行当前 Web 请求期间生成了未处理的异常。有关异常来源和位置的信息可以使用下面的异常堆栈跟踪来识别。
堆栈跟踪:
[NullReferenceException:ServiceLocator 尚未初始化;我试图检索 SharpArch.Core.CommonValidator.IValidator] SharpArch.Core.SafeServiceLocator`1.GetService() 在 C:\MyStuff\Projects\SharpArchGitHub\src\SharpArch\SharpArch.Core\SafeServiceLocator.cs:20 SharpArch.Core.DomainModel.ValidatableObject.get_Validator() 在 C:\MyStuff\Projects\SharpArchGitHub\src\SharpArch\SharpArch.Core\DomainModel\ValidatableObject.cs:20 SharpArch.Core.DomainModel.ValidatableObject.ValidationResults() 在 C:\MyStuff\Projects\SharpArchGitHub\src\SharpArch\SharpArch.Core\DomainModel\ValidatableObject.cs:15 C:\MyStuff\Projects\SharpArchGitHub\src\SharpArch\SharpArch.Web\ModelBinder\SharpModelBinder.cs:40 中的 SharpArch.Web.ModelBinder.SharpModelBinder.OnModelUpdated(ControllerContext controllerContext, ModelBindingContext bindingContext) System.Web.Mvc.DefaultModelBinder.BindComplexElementalModel(ControllerContext 控制器上下文,ModelBindingContext 绑定上下文,对象模型)+304 System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext 控制器上下文,ModelBindingContext 绑定上下文)+772 System.Web.Mvc.DefaultModelBinder.BindModel(ControllerContext 控制器上下文,ModelBindingContext 绑定上下文)+345 C:\MyStuff\Projects\SharpArchGitHub\src\SharpArch\SharpArch.Web\ModelBinder\SharpModelBinder.cs 中的 SharpArch.Web.ModelBinder.SharpModelBinder.BindModel(ControllerContext controllerContext、ModelBindingContext bindingContext):241 System.Web.Mvc.ControllerActionInvoker.GetParameterValue(ControllerContextcontrollerContext,ParameterDescriptorparameterDescriptor)+219 System.Web.Mvc.ControllerActionInvoker.GetParameterValues(ControllerContextcontrollerContext,ActionDescriptoractionDescriptor)+109 System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContextcontrollerContext,字符串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 步骤,Boolean&completedSynchronously) +75
Server Error in '/' Application.
ServiceLocator has not been initialized; I was trying to retrieve SharpArch.Core.CommonValidator.IValidator
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.NullReferenceException: ServiceLocator has not been initialized; I was trying to retrieve SharpArch.Core.CommonValidator.IValidator
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: ServiceLocator has not been initialized; I was trying to retrieve SharpArch.Core.CommonValidator.IValidator]
SharpArch.Core.SafeServiceLocator`1.GetService() in C:\MyStuff\Projects\SharpArchGitHub\src\SharpArch\SharpArch.Core\SafeServiceLocator.cs:20
SharpArch.Core.DomainModel.ValidatableObject.get_Validator() in C:\MyStuff\Projects\SharpArchGitHub\src\SharpArch\SharpArch.Core\DomainModel\ValidatableObject.cs:20
SharpArch.Core.DomainModel.ValidatableObject.ValidationResults() in C:\MyStuff\Projects\SharpArchGitHub\src\SharpArch\SharpArch.Core\DomainModel\ValidatableObject.cs:15
SharpArch.Web.ModelBinder.SharpModelBinder.OnModelUpdated(ControllerContext controllerContext, ModelBindingContext bindingContext) in 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) in 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
自从我查看 S#arp 架构框架以来已经有一段时间了,但我的猜测是您缺少一些初始化例程来设置其 IOC 容器。如果我没记错的话,S#arp 支持多个 IOC 容器,这些容器包装在 ServiceLocator 中。
您是否尝试过在 S#arp Architecture 邮件列表上发布您的问题还有?
It's been awhile since I've looked at the S#arp Architecture framework, but my guess is that you're missing some initialization routine to set up its IOC container. If I recall correctly, S#arp supports multiple IOC containers, which are wrapped in a ServiceLocator.
Have you tried posting your question on the S#arp Architecture mailing list as well?