/// <summary> /// Creates a new host for the HermesScheduleItemService and starts the service. /// Also creates and opens a client for accessing the service. /// </summary> private void HostHermesScheduleItemServiceAndOpenClient() { //Create host host = new ServiceHost(typeof(HermesScheduleItemService), endPointAddress); //Create a custom binding for enabling transaction flow from client to service NetTcpBinding tcpBinding = new NetTcpBinding(); tcpBinding.TransactionFlow = true; tcpBinding.TransactionProtocol = TransactionProtocol.WSAtomicTransactionOctober2004; //Create end point for service host.AddServiceEndpoint(typeof(HermesScheduleItemService), tcpBinding, endPointAddress); host.Open(); //Create client instance for making calls client = new HermesScheduleItemServiceClient( tcpBinding, new EndpointAddress(endPointAddress.OriginalString)); client.ClientCredentials.Windows.AllowedImpersonationLevel = TokenImpersonationLevel.Impersonation; client.Open(); }
/// <summary> /// Creates a new host for the HermesScheduleItemService and starts the service. /// Also creates and opens a client for accessing the service. /// </summary> private void HostHermesScheduleItemServiceAndOpenClient() { // Create host host = new ServiceHost(typeof(HermesScheduleItemService), endPointAddress); // Create a custom binding for enabling transaction flow from client to service NetTcpBinding tcpBinding = new NetTcpBinding(); tcpBinding.TransactionFlow = true; tcpBinding.TransactionProtocol = TransactionProtocol.WSAtomicTransactionOctober2004; // Create end point for service host.AddServiceEndpoint(typeof(HermesScheduleItemService), tcpBinding, endPointAddress); host.Open(); // Create client client for making calls client = new HermesScheduleItemServiceClient( tcpBinding, new EndpointAddress(endPointAddress.OriginalString)); client.ClientCredentials.Windows.AllowedImpersonationLevel = TokenImpersonationLevel.Impersonation; client.Open(); // Increase timeout incase tests run more than normal timeout period ((IContextChannel)client.InnerChannel).OperationTimeout = new TimeSpan(0, 5, 0); }