所以我有这个我在过去半年左右一直在开发的 webapp。最近我发现 NancyFx 在 nuget 上已经升级到 0.16 并且去升级(从 0.12)。在我的机器上一切都很顺利,或者说看起来很顺利。但是在 CI 机器上,事情却出奇地错误。我得到以下堆栈跟踪:
2013-02-25 14:28:51:145 - OtherApp - ERROR METHOD - Nancy.TinyIoc.TinyIoCContainer.ConstructType
2013-02-25 14:28:51:145 - OtherApp - ERROR MESSAGE - Unable to resolve type: Nancy.Routing.DefaultRouteResolver
2013-02-25 14:28:51:145 - at Nancy.TinyIoc.TinyIoCContainer.ConstructType(Type requestedType, Type implementationType, ConstructorInfo constructor, NamedParameterOverloads parameters, ResolveOptions options)
at Nancy.TinyIoc.TinyIoCContainer.SingletonFactory.GetObject(Type requestedType, TinyIoCContainer container, NamedParameterOverloads parameters, ResolveOptions options)
at Nancy.TinyIoc.TinyIoCContainer.ResolveInternal(TypeRegistration registration, NamedParameterOverloads parameters, ResolveOptions options)
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Linq.Enumerable.<CastIterator>d__b1`1.MoveNext()
at Nancy.Diagnostics.DiagnosticsModuleCatalog.ConfigureContainer(IModuleKeyGenerator moduleKeyGenerator, IEnumerable`1 providers, IRootPathProvider rootPathProvider, IRequestTracing requestTracing, NancyInternalConfiguration configuration, DiagnosticsConfiguration diagnosticsConfiguration)
at Nancy.Diagnostics.DiagnosticsModuleCatalog..ctor(IModuleKeyGenerator keyGenerator, IEnumerable`1 providers, IRootPathProvider rootPathProvider, IRequestTracing requestTracing, NancyInternalConfiguration configuration, DiagnosticsConfiguration diagnosticsConfiguration)
at Nancy.Diagnostics.DiagnosticsHook.Enable(DiagnosticsConfiguration diagnosticsConfiguration, IPipelines pipelines, IEnumerable`1 providers, IRootPathProvider rootPathProvider, IEnumerable`1 serializers, IRequestTracing requestTracing, NancyInternalConfiguration configuration, IModelBinderLocator modelBinderLocator, IEnumerable`1 responseProcessors, ICultureService cultureService)
at Nancy.Diagnostics.DefaultDiagnostics.Initialize(IPipelines pipelines)
at Nancy.Bootstrapper.NancyBootstrapperBase`1.Initialise()
at Nancy.Hosting.Self.NancyHost..ctor(INancyBootstrapper bootstrapper, HostConfiguration configuration, Uri[] baseUris)
at Core.Jobs.HealthMonitorJob.Execute(IJobExecutionContext context)
at Quartz.Core.JobRunShell.Run()
现在我已经将问题追踪到一个特定的模块,该模块需要 TinyIoC 需要为其处理创建的大量参数,如果我禁用该模块,Nancy 可以正常启动,但当然没有必要的功能。在我的机器上它完美无缺。两者之间唯一明显的区别是我的机器运行的是 Windows 7,而 CI 运行的是 Windows Server 2008 R2 Enterprise SP1。有没有其他人有过这样的事情发生的经验?它快把我逼疯了。