【问题标题】:How to deploy and devforce entityserver as console application with topshelf如何使用 topshelf 将实体服务器部署和开发为控制台应用程序
【发布时间】:2017-03-21 10:44:13
【问题描述】:

我们希望使用带有 topshelf 的 entitymanager 控制台以 3 层模式运行我们的 wpf 客户端应用程序,以在本地测试和运行 entityserver。

我们只能使用提供的工具 ServerConsole.exe 找到文档,但我们想自己构建控制台。

是否可以使用控制台应用程序构建实体服务器并在本地运行?

文档http://drc.ideablade.com/devforce-2012/bin/view/Documentation/deploy-console 没有解释如何在没有提供的 ServerConsole.exe 的情况下自己构建控制台。

【问题讨论】:

    标签: devforce


    【解决方案1】:

    DevForce 将以三种方式托管EntityServer(实际上是四种):

    • 通过 ServerConsole.exe 作为控制台应用程序
    • 通过 ServerService.exe 作为 Windows 服务
    • 通过 IIS/ASP.NET
    • 第 4 个选项并不是真正的托管服务,但每当您在 2 层模式下运行时,都会使用本地进程内 EntityServer。

    托管选项都至少启动两个 WCF 服务:EntityServiceHostEntityServerHost。这些是System.ServiceModel.ServiceHost 的公共子类型,可以在 IdeaBlade.EntityModel.Server 程序集中找到。我们不提供有关如何使用它们的文档或指导。

    如果您能告诉我更多关于您的要求,也许我可以提供其他替代方案。

    【讨论】:

    • 我们不断收到在 n 层模式下运行 wpf 应用程序的错误。我们正在为 wpf-ntier 应用程序使用 Visual Studio 模板,但是一旦我们想连接到服务器层,我们就会收到一些磨损的错误。我们在localhost:8080/TestEntityService 设置了一个可视化目录
    【解决方案2】:

    我们不断收到以 n 层模式运行 wpf 应用程序的错误。

    我们在http://localhost:8080/TestEntityService设置了一个可视目录

    我们正在为 wpf-ntier 应用程序使用 Visual Studio 模板,但只要我们想连接到服务器层,就会收到一些磨损的错误。

    我们可以使用 Internet Explorer 浏览到该服务:http://localhost:8080/TestEntityService/EntityServer.svc

    但是我们的 wpf 客户端总是抛出一个非常糟糕的异常:

    Sunrise.Shells.Lisp.vshost.exe Error: 0 : 2017-03-23 
    
    10:29:12.6148|ERROR||Sunrise.Modules.Instruments.ViewModels.HostViewModel+<LoadInstruments>d__112 | MoveNext ==> Exception has been thrown by the target of an invocation.
    InnerException:
    Communications with the service 'EntityServer' using Uri of 'http://localhost:8080/TestEntityService/EntityServer.svc cannot be started.  See the internal exception for more information.
    InnerException:
    Type 'MongoDB.Driver.Core.WireProtocol.Messages.Encoders.BinaryEncoders.InsertMessageBinaryEncoder`1+InsertFlags[TDocument]' cannot be exported as a schema type because it is an open generic type. You can only export a generic type if all its generic parameter types are actual types.
    StackTrace:
       at System.Runtime.Serialization.DataContractSet.EnsureTypeNotGeneric(Type type)
       at System.Runtime.Serialization.XsdDataContractExporter.GetSchemaTypeName(Type type)
       at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.ValidateDataContractType(Type type)
       at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter..ctor(OperationDescription description, DataContractFormatAttribute dataContractFormatAttribute, DataContractSerializerOperationBehavior serializerFactory)
       at System.ServiceModel.Description.DataContractSerializerOperationBehavior.GetFormatter(OperationDescription operation, Boolean& formatRequest, Boolean& formatReply, Boolean isProxy)
       at System.ServiceModel.Description.DataContractSerializerOperationBehavior.System.ServiceModel.Description.IOperationBehavior.ApplyClientBehavior(OperationDescription description, ClientOperation proxy)
       at System.ServiceModel.Description.DispatcherBuilder.BindOperations(ContractDescription contract, ClientRuntime proxy, DispatchRuntime dispatch)
       at System.ServiceModel.Description.DispatcherBuilder.ApplyClientBehavior(ServiceEndpoint serviceEndpoint, ClientRuntime clientRuntime)
       at System.ServiceModel.Description.DispatcherBuilder.BuildProxyBehavior(ServiceEndpoint serviceEndpoint, BindingParameterCollection& parameters)
       at System.ServiceModel.Channels.ServiceChannelFactory.BuildChannelFactory(ServiceEndpoint serviceEndpoint, Boolean useActiveAutoClose)
       at System.ServiceModel.ChannelFactory.CreateFactory()
       at System.ServiceModel.ChannelFactory.OnOpening()
       at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
       at System.ServiceModel.Channels.CommunicationObject.Open()
       at System.ServiceModel.ChannelFactory.EnsureOpened()
       at System.ServiceModel.ChannelFactory`1.CreateChannel(EndpointAddress address, Uri via)
       at System.ServiceModel.ChannelFactory`1.CreateChannel(EndpointAddress address)
       at IdeaBlade.EntityModel.WcfProxy`1.CreateProxyCore()
    

    服务器没有任何对 mongodb dll 的引用,但客户端无法连接。

    Type 'MongoDB.Driver.Core.WireProtocol.Messages.Encoders.BinaryEncoders.InsertMessageBinaryEncoder`1+InsertFlags[TDocument]'
    

    【讨论】:

    • 在初始化 EntityServer 的 WCF 代理时,客户端发生此错误。在此初始化期间,DF 将探测“已知类型”,并且看起来此 MongoDB 程序集中的类型正在被拾取。如果您的实体类型之一引用了该类型,则可能会发生这种情况,但如果没有更多信息,很难说。您可以使用 IdeaBlade.Core.Composition.CompositionHost.SearchPatterns.Add("someassembly.dll"); 将程序集排除在此初始化探测之外。见drc.ideablade.com/devforce-2012/bin/view/Documentation/…
    • 嗨,Kim,从客户端删除了所有 mongodb 引用,它正在工作。但是当然我们仍然需要客户端上的这个 mongodb 连接.. 我将按照文档来控制组合搜索模式。
    猜你喜欢
    • 2012-06-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-21
    • 2016-12-23
    • 1970-01-01
    • 1970-01-01
    • 2011-05-10
    相关资源
    最近更新 更多