1

我在 .net 应用程序中使用 ServiceStack (3.9.32)

我正在使用 XSD2Code 生成基于 XSD 创建请求

注册路线时,

Routes.Add<ahdc.core.entities.external.order.LabOrder>("/LabOrder", "POST")
                .Add<Request.ResultPoll>("/ResultPoll/{uid*}", "GET")
                .Add<Request.ResultPoll>("/ResultPoll", "POST")
                .Add<Request.Result>("/Result/{externalId*}", "GET")
                .Add<Request.Result>("/Result", "POST")
                .Add<Request.LabReport>("/LabReport", "GET")
                .Add<Request.OrderedTests>("/OrderedTests", "POST")
                .Add<Request.OrderedTests>("/OrderedTests/{externalId*}", "GET")
                **.Add<ahdc.external.Request.HL7Order.OPL_O37>("/HL7LabOrder", "POST");**

粗体部分是新行。服务堆栈抛出此异常:

[NullReferenceException: Object reference not set to an instance of an object.]
   ServiceStack.Text.Common.DeserializeSpecializedCollections`2.GetGenericEnumerableParseFn() +254
   ServiceStack.Text.Common.DeserializeSpecializedCollections`2.GetParseFn() +1458
   ServiceStack.Text.Common.DeserializeSpecializedCollections`2..cctor() +39

[TypeInitializationException: The type initializer for 'ServiceStack.Text.Common.DeserializeSpecializedCollections`2' threw an exception.]
   ServiceStack.Text.Common.DeserializeSpecializedCollections`2.get_Parse() +19
   ServiceStack.Text.Common.JsReader`1.GetCoreParseFn() +3025
   ServiceStack.Text.Common.JsReader`1.GetParseFn() +315
   ServiceStack.Text.Jsv.JsvReader`1..cctor() +96

[TypeInitializationException: The type initializer for 'ServiceStack.Text.Jsv.JsvReader`1' threw an exception.]
   ServiceStack.Text.Jsv.JsvReader`1.GetParseFn() +0
   ServiceStack.Text.Jsv.JsvReader.GetParseFn(Type type) +427
   ServiceStack.Text.Jsv.JsvTypeSerializer.GetParseFn(Type type) +38
   ServiceStack.Text.Common.TypeAccessor.Create(ITypeSerializer serializer, TypeConfig typeConfig, PropertyInfo propertyInfo) +148
   ServiceStack.Text.Common.DeserializeTypeRef.GetTypeAccessorMap(TypeConfig typeConfig, ITypeSerializer serializer) +345
   ServiceStack.Text.Common.DeserializeType`1.GetParseMethod(TypeConfig typeConfig) +237
   ServiceStack.Text.Common.JsReader`1.GetCoreParseFn() +3589
   ServiceStack.Text.Common.JsReader`1.GetParseFn() +315
   ServiceStack.Text.Jsv.JsvReader`1..cctor() +96

[TypeInitializationException: The type initializer for 'ServiceStack.Text.Jsv.JsvReader`1' threw an exception.]
   ServiceStack.Text.Jsv.JsvReader`1.GetParseFn() +0
   ServiceStack.Text.Jsv.JsvReader.GetParseFn(Type type) +427
   ServiceStack.ServiceModel.Serialization.StringMapTypeDeserializer..ctor(Type type) +264
   ServiceStack.ServiceHost.RestPath..ctor(Type requestType, String path, String verbs, String summary, String notes) +2466
   ServiceStack.ServiceHost.ServiceRoutes.Add(String restPath, String verbs) +141
   ahdc.external.App_Start.AppHost.Configure(Container container) in D:\vb.net\ahdc_website-trunk\ahdc.external\App_Start\AppHost.cs:50
   ServiceStack.WebHost.Endpoints.AppHostBase.Init() +218
   ahdc.external.App_Start.AppHost.Start() in D:\vb.net\ahdc_website-trunk\ahdc.external\App_Start\AppHost.cs:142

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
   System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +192
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +108
   System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) +19
   WebActivator.BaseActivationMethodAttribute.InvokeMethod() +236
   WebActivator.ActivationManager.RunActivationMethods() +534
   WebActivator.ActivationManager.RunPreStartMethods() +41
   WebActivator.ActivationManager.Run() +64

[InvalidOperationException: The pre-application start initialization method Run on type WebActivator.ActivationManager threw an exception with the following error message: Exception has been thrown by the target of an invocation..]
   System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection`1 methods, Func`1 setHostingEnvironmentCultures) +550
   System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +132
   System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath) +90
   System.Web.Compilation.BuildManager.ExecutePreAppStart() +135
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +516

[HttpException (0x80004005): The pre-application start initialization method Run on type WebActivator.ActivationManager threw an exception with the following error message: Exception has been thrown by the target of an invocation..]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9873912
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
   System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +456

我很困惑为什么。

4

0 回答 0