我开始研究CoiniumServ代码。代码将在Windows上运行,但在我的Linux服务器上运行失败。
堆栈追踪:
Nancy.TinyIoc.TinyIoCResolutionException:
Unable to resolve type:
CoiniumServ.Server.Web.WebServer --->
Nancy.TinyIoc.TinyIoCResolutionException: Unable to resolve type:
CoiniumServ.Server.Web.NancyBootstrapper --->
System.TypeInitializationException: An exception was thrown by the type initializer for Nancy.Bootstrapper.AssemblyTypeScanner --->
System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (System.Reflection.Assembly,bool)
at System.Reflection.Assembly.GetExportedTypes () [0x00000] in <filename unknown>:0
at Nancy.Extensions.AssemblyExtensions.SafeGetExportedTypes (System.Reflection.Assembly assembly) [0x00000] in <filename unknown>:0
at Nancy.Bootstrapper.AppDomainAssemblyTypeScanner.<UpdateTypes>b__16 (System.Reflection.Assembly assembly) [0x00000] in <filename unknown>:0
at System.Linq.Enumerable+<CreateSelectManyIterator>c__Iterator14`3[System.Reflection.Assembly,System.Type,<>f__AnonymousType0`2[System.Reflection.Assemb]].MoveNext () [0x00000] in <filename unknown>:0
at System.Linq.Enumerable+<CreateWhereIterator>c__Iterator1E`1[<>f__AnonymousType0`2[System.Reflection.Assembly,System.Type]].MoveNext () [0x00000] in <fn>:0
at System.Linq.Enumerable+<CreateSelectIterator>c__Iterator10`2[<>f__AnonymousType0`2[System.Reflection.Assembly,System.Type],System.Type].MoveNext () [0lename unknown>:0
at System.Linq.Enumerable.ToArray[Type] (IEnumerable`1 source) [0x00000] in <filename unknown>:0
at Nancy.Bootstrapper.AppDomainAssemblyTypeScanner.UpdateTypes () [0x00000] in <filename unknown>:0
at Nancy.Bootstrapper.AppDomainAssemblyTypeScanner.LoadAssembliesWithNancyReferences () [0x00000] in <filename unknown>:0
at Nancy.Bootstrapper.AppDomainAssemblyTypeScanner..cctor () [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at Nancy.Conventions.NancyConventions.BuildDefaultConventions () <0x0002f>
at Nancy.Conventions.NancyConventions..ctor () <0x00013>
at Nancy.Bootstrapper.NancyBootstrapperBase`1<Nancy.TinyIoc.TinyIoCContainer>..ctor () <0x0005f>
at Nancy.Bootstrapper.NancyBootstrapperWithRequestContainerBase`1<Nancy.TinyIoc.TinyIoCContainer>..ctor () <0x00087>
at Nancy.DefaultNancyBootstrapper..ctor () <0x00013>
at CoiniumServ.Server.Web.NancyBootstrapper..ctor (CoiniumServ.Container.Context.IApplicationContext,CoiniumServ.Statistics.IStatisticsManager,CoiniumServ.Pools.IPoolManager,CoiniumServ.Configuration.IConfigManager) <0x00033>
at (wrapper dynamic-method) object.lambda_method (System.Runtime.CompilerServices.Closure,object[]) <0x00357>
at Nancy.TinyIoc.TinyIoCContainer.ConstructType (System.Type,System.Type,System.Reflection.ConstructorInfo,Nancy.TinyIoc.NamedParameterOverloads,Nancy.TinyIoc.ResolveOptions) <0x003fe>
--- 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) [0x00000] in <filename unknown>:0
at Nancy.TinyIoc.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, Nancy.TinyIoc.ResolveOptions options) [0x00000] in <filename unknown>:0
at Nancy.TinyIoc.TinyIoCContainer+SingletonFactory.GetObject (System.Type requestedType, Nancy.TinyIoc.TinyIoCContainer container, Nancy.TinyIoc.NamedParameterOverloads parameters, Nancy.TinyIoc.ResolveOptions options) [0x00000] in <filename unknown>:0
at Nancy.TinyIoc.TinyIoCContainer.ResolveInternal (Nancy.TinyIoc.TypeRegistration registration, Nancy.TinyIoc.NamedParameterOverloads parameters, Nancy.TinyIoc.ResolveOptions options) [0x00000] in <filename unknown>: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) [0x00000] in <filename unknown>:0
at Nancy.TinyIoc.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, Nancy.TinyIoc.ResolveOptions options) [0x00000] in <filename unknown>:0
at Nancy.TinyIoc.TinyIoCContainer+SingletonFactory.GetObject (System.Type requestedType, Nancy.TinyIoc.TinyIoCContainer container, Nancy.TinyIoc.NamedParameterOverloads parameters, Nancy.TinyIoc.ResolveOptions options) [0x00000] in <filename unknown>:0
at Nancy.TinyIoc.TinyIoCContainer.ResolveInternal (Nancy.TinyIoc.TypeRegistration registration, Nancy.TinyIoc.NamedParameterOverloads parameters, Nancy.TinyIoc.ResolveOptions options) [0x00000] in <filename unknown>:0
文件/类包含在构建文件中,并在编译期间列出。在编译期间抛出了一些警告,但仅在引用代码中的一些未使用的变量时。我已经检查过所引用的dll都被复制了。我还尝试删除nuget提取的软件包,并在构建之前运行手动清理。
我不是真正的C#人,所以我不确定从哪里开始。
[编辑] windows版本是用VisualStudio构建的,linux是通过mono(xbuild)在Linux机器上构建的
答案 0 :(得分:1)
如果有人在搜索中提起这件事,我会发布答案。
Linux上的mono版本没有生成一堆.xml配置文件。
这个答案指出了我正确的方向:http://forum.unity3d.com/threads/ideas-reflectiontypeloadexception-the-classes-in-the-module-cannot-be-loaded.230389/
将Linux上的构建输出与Windows上的构建输出进行比较,显示缺少的文件。走简单的路线,我将文件从Windows复制到Linux并运行。
知道从纯粹的Linux POV中查找的位置会很好。如果我发现Linux构建说明中遗漏了什么,我会添加注释。