【问题标题】:NancyFx + Mono: Unable to resolve type: Nancy.NancyEngineNancyFx + Mono:无法解析类型:Nancy.NancyEngine
【发布时间】:2017-04-18 11:58:06
【问题描述】:

我刚刚升级到单声道 4.8.0。

在运行我的 nancy 应用程序时,我现在收到了这个无法描述的错误:

[ERROR] FATAL UNHANDLED EXCEPTION: System.InvalidOperationException: Something went wrong when trying to satisfy one of the dependencies during composition, make sure that you've registered all new dependencies in the container and inspect the innerexception for more details. ---> Nancy.TinyIoc.TinyIoCResolutionException: Unable to resolve type: Nancy.NancyEngine ---> Nancy.TinyIoc.TinyIoCResolutionException: Unable to resolve type: Nancy.Routing.DefaultRequestDispatcher ---> Nancy.TinyIoc.TinyIoCResolutionException: Unable to resolve type: Nancy.Routing.DefaultRouteResolver ---> Nancy.TinyIoc.TinyIoCResolutionException: Unable to resolve type: Nancy.Routing.RouteCache ---> System.NullReferenceException: Object reference not set to an instance of an object

它说有一些依赖项没有正确注册。但是,通常情况下,这伴随着(沿着内部异常链)伴随着无法解决依赖的指示。

现在它只是说Unable to resolve type: Nancy.NancyEngine,这是一个我确信我不需要为此修改的类。此外,在堆栈跟踪的末尾(通常有一个线索表明是哪个依赖导致了这种情况),它显示Unable to resolve type: Nancy.Routing.RouteCache ---> System.NullReferenceException: Object reference not set to an instance of an object

下面是完整的堆栈跟踪。我错过了什么?感谢您对此事的任何见解!

Stack overflow in unmanaged: IP: 0x1bec8c, fault addr: 0xbf767fec
[ERROR] FATAL UNHANDLED EXCEPTION: System.InvalidOperationException: Something went wrong when trying to satisfy one of the dependencies during composition, make sure that you've registered all new dependencies in the container and inspect the innerexception for more details. ---> Nancy.TinyIoc.TinyIoCResolutionException: Unable to resolve type: Nancy.NancyEngine ---> Nancy.TinyIoc.TinyIoCResolutionException: Unable to resolve type: Nancy.Routing.DefaultRequestDispatcher ---> Nancy.TinyIoc.TinyIoCResolutionException: Unable to resolve type: Nancy.Routing.DefaultRouteResolver ---> Nancy.TinyIoc.TinyIoCResolutionException: Unable to resolve type: Nancy.Routing.RouteCache ---> System.NullReferenceException: Object reference not set to an instance of an object
   at System.Exception..ctor (System.String message, System.Exception innerException) in <filename unknown>:line 0
   at Nancy.TinyIoc.TinyIoCResolutionException..ctor (System.Type type, System.Exception innerException) in <filename unknown>:line 0
   at Nancy.TinyIoc.TinyIoCContainer.ResolveInternal (Nancy.TinyIoc.TypeRegistration registration, Nancy.TinyIoc.NamedParameterOverloads parameters, Nancy.TinyIoc.ResolveOptions options) in <filename unknown>:line 0
   at Nancy.TinyIoc.TinyIoCContainer.<ResolveAllInternal>b__43 (Nancy.TinyIoc.TypeRegistration registration) in <filename unknown>:line 0
   at System.Linq.Enumerable+WhereSelectEnumerableIterator`2[TSource,TResult].MoveNext () in <filename unknown>:line 0
   at System.Linq.Enumerable+<CastIterator>c__Iterator17`1[TResult].MoveNext () in <filename unknown>:line 0
   at Nancy.Routing.RouteCache.BuildCache (IEnumerable`1 modules) in <filename unknown>:line 0
   at Nancy.Routing.RouteCache..ctor (INancyModuleCatalog moduleCatalog, INancyContextFactory contextFactory, IRouteSegmentExtractor routeSegmentExtractor, IRouteDescriptionProvider routeDescriptionProvider, ICultureService cultureService, IEnumerable`1 routeMetadataProviders) in <filename unknown>:line 0
   at (wrapper dynamic-method) System.Object:lambda_method (System.Runtime.CompilerServices.Closure,object[])
   at Nancy.TinyIoc.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, Nancy.TinyIoc.NamedParameterOverloads parameters, Nancy.TinyIoc.ResolveOptions options) in <filename unknown>:line 0
  --- End of inner exception stack trace ---
   at Nancy.TinyIoc.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, Nancy.TinyIoc.NamedParameterOverloads parameters, Nancy.TinyIoc.ResolveOptions options) in <filename unknown>:line 0
   at Nancy.TinyIoc.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, Nancy.TinyIoc.ResolveOptions options) in <filename unknown>:line 0
   at Nancy.TinyIoc.TinyIoCContainer+SingletonFactory.GetObject (System.Type requestedType, Nancy.TinyIoc.TinyIoCContainer container, Nancy.TinyIoc.NamedParameterOverloads parameters, Nancy.TinyIoc.ResolveOptions options) in <filename unknown>:line 0
   at Nancy.TinyIoc.TinyIoCContainer.ResolveInternal (Nancy.TinyIoc.TypeRegistration registration, Nancy.TinyIoc.NamedParameterOverloads parameters, Nancy.TinyIoc.ResolveOptions options) in <filename unknown>:line 0
  --- End of inner exception stack trace ---
   at Nancy.TinyIoc.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, Nancy.TinyIoc.NamedParameterOverloads parameters, Nancy.TinyIoc.ResolveOptions options) in <filename unknown>:line 0
   at Nancy.TinyIoc.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, Nancy.TinyIoc.ResolveOptions options) in <filename unknown>:line 0
   at Nancy.TinyIoc.TinyIoCContainer+SingletonFactory.GetObject (System.Type requestedType, Nancy.TinyIoc.TinyIoCContainer container, Nancy.TinyIoc.NamedParameterOverloads parameters, Nancy.TinyIoc.ResolveOptions options) in <filename unknown>:line 0
   at Nancy.TinyIoc.TinyIoCContainer.ResolveInternal (Nancy.TinyIoc.TypeRegistration registration, Nancy.TinyIoc.NamedParameterOverloads parameters, Nancy.TinyIoc.ResolveOptions options) in <filename unknown>:line 0
  --- End of inner exception stack trace ---
   at Nancy.TinyIoc.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, Nancy.TinyIoc.NamedParameterOverloads parameters, Nancy.TinyIoc.ResolveOptions options) in <filename unknown>:line 0
   at Nancy.TinyIoc.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, Nancy.TinyIoc.ResolveOptions options) in <filename unknown>:line 0
   at Nancy.TinyIoc.TinyIoCContainer+SingletonFactory.GetObject (System.Type requestedType, Nancy.TinyIoc.TinyIoCContainer container, Nancy.TinyIoc.NamedParameterOverloads parameters, Nancy.TinyIoc.ResolveOptions options) in <filename unknown>:line 0
   at Nancy.TinyIoc.TinyIoCContainer.ResolveInternal (Nancy.TinyIoc.TypeRegistration registration, Nancy.TinyIoc.NamedParameterOverloads parameters, Nancy.TinyIoc.ResolveOptions options) in <filename unknown>:line 0
  --- End of inner exception stack trace ---
   at Nancy.TinyIoc.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, Nancy.TinyIoc.NamedParameterOverloads parameters, Nancy.TinyIoc.ResolveOptions options) in <filename unknown>:line 0
   at Nancy.TinyIoc.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, Nancy.TinyIoc.ResolveOptions options) in <filename unknown>:line 0
   at Nancy.TinyIoc.TinyIoCContainer+SingletonFactory.GetObject (System.Type requestedType, Nancy.TinyIoc.TinyIoCContainer container, Nancy.TinyIoc.NamedParameterOverloads parameters, Nancy.TinyIoc.ResolveOptions options) in <filename unknown>:line 0
   at Nancy.TinyIoc.TinyIoCContainer.ResolveInternal (Nancy.TinyIoc.TypeRegistration registration, Nancy.TinyIoc.NamedParameterOverloads parameters, Nancy.TinyIoc.ResolveOptions options) in <filename unknown>:line 0
  --- End of inner exception stack trace ---
   at Nancy.Bootstrapper.NancyBootstrapperBase`1[TContainer].SafeGetNancyEngineInstance () in <filename unknown>:line 0
   at Nancy.Bootstrapper.NancyBootstrapperBase`1[TContainer].GetEngine () in <filename unknown>:line 0
   at Nancy.Hosting.Self.NancyHost..ctor (INancyBootstrapper bootstrapper, Nancy.Hosting.Self.HostConfiguration configuration, System.Uri[] baseUris) in <filename unknown>:line 0
   at Nancy.Hosting.Self.NancyHost..ctor (System.Uri[] baseUris) in <filename unknown>:line 0
   at Reflect.Web.v2.MainClass.Main (System.String[] args) in <filename unknown>:line 0

【问题讨论】:

    标签: c# asp.net .net mono nancy


    【解决方案1】:

    一直向右显示: 无法解析类型:Nancy.Routing.RouteCache ---> System.NullReferenceException:对象引用未设置为对象的实例 在 System.Exception..ctor (System.String message, System.Exception innerException) in :line 0

    RouteCache 通常会触发 Nancy 模块的解析。 您的一个模块的构造函数中似乎有一个 NullReferenceException

    【讨论】:

      猜你喜欢
      • 2015-10-22
      • 1970-01-01
      • 2013-12-14
      • 1970-01-01
      • 2017-07-19
      • 2016-09-24
      • 2014-11-07
      • 2021-08-28
      • 1970-01-01
      相关资源
      最近更新 更多