private static void HostProcessingService() { WorkflowInstanceManager wfInstanceManager = new WorkflowInstanceManager( null, (exception) => new ExceptionInfo(exception).ToString()) { OnWorkflowInstanceCompleted = (rootWorkItem) => { XmlSerializer serializer = new XmlSerializer(typeof(WorkItemWithHistory)); using (Stream serializationStream = File.Create("C:\\Temp\\expInfo.xml")) { serializer.Serialize(serializationStream, rootWorkItem); } } }; ProcessEngineService processingServer = new ProcessEngineService(wfInstanceManager); RawDataManagerService rawDatabaseSummary = new RawDataManagerService(); using (ServiceHost serviceHost = new ServiceHost(processingServer)) using (ServiceHost rawDatabaseSummaryHost = new ServiceHost(rawDatabaseSummary)) { serviceHost.Open(); rawDatabaseSummaryHost.Open(); StartLog4Net(); //TestLogerClass.TestLogger(); Console.WriteLine("Server is running. Press return to stop..."); Console.ReadLine(); } }
private List <ServiceHost> CreateServiceHosts() { if (_serviceHostList != null) { Debug.Assert(true, "Program Error: attempting to create ServiceHost's a second time.\nPlease call AbortAndCloseServiceHosts() before attempting to recreate the ServiceHost's."); } else { WorkflowInstanceManager wfInstanceManager = new WorkflowInstanceManager( null, (exception) => new ExceptionInfo(exception).ToString()) { OnWorkflowInstanceCompleted = (rootWorkItem) => { // Log.Fatal("test ========== done with this workflow"); XmlSerializer serializer = new XmlSerializer(typeof(WorkItemWithHistory)); using (Stream serializationStream = File.Create("C:\\Temp\\expInfo.xml")) { serializer.Serialize(serializationStream, rootWorkItem); } } }; ProcessEngineService processingServer = new ProcessEngineService(wfInstanceManager); //jlin prepare for dynamically resolve component known type ServiceHost ProcessEngineHost = new ServiceHost(processingServer); foreach (ServiceEndpoint endpoint in ProcessEngineHost.Description.Endpoints) { foreach (OperationDescription operation in endpoint.Contract.Operations) { operation.Behaviors.Find <DataContractSerializerOperationBehavior>().DataContractResolver = new MnemeTypeResolver(); } } _serviceHostList = new List <ServiceHost>() { //new ServiceHost(rawDatabaseSummary), //new ServiceHost(processingServer) ProcessEngineHost }; } return(_serviceHostList); }