public IRemoteSide CreateInstance() { IRemoteSide ret = null; var cm = diContainer.GetLazyBoundInstance <IWCFConfigManager>().Value; var clientServiceInstance = diContainer.GetLazyBoundInstance <IRemoteSideCommunicationHandler>().Value; ret = new WCFServiceHost(diContainer, (IRemoteSideCommunicationContract)clientServiceInstance, new Uri(cm.ClientServiceAddress)); clientServiceInstance.AssignRemoteSide(ret); return(ret); }
public virtual void AssignRemoteSide(IRemoteSide remoteSide) { if (remoteSide == null) { throw new ArgumentNullException("clientServiceHostInstance"); } this.remoteSide = remoteSide; this.remoteSide.StateChanged += new EventHandler(remoteSide_StateChanged); communicationContractsByRemoteSideIDDict.Add(remoteSide.ID, (IRemoteSideCommunicationContract)remoteSide); remoteSideIDsByCommunicationContractDict.Add((IRemoteSideCommunicationContract)remoteSide, remoteSide.ID); }
public IRemoteSide CreateInstance() { IRemoteSide ret = null; // init binding var binding = new NetTcpBinding(); binding.Security.Mode = SecurityMode.None; binding.Security.Transport.ClientCredentialType = TcpClientCredentialType.None; var cm = diContainer.GetLazyBoundInstance <IWCFConfigManager>().Value; WCFHelper.ApplyWCFBindingLimits( binding, cm.ClientServiceMaxSizeInBytes, cm.ClientServiceTimeoutInSecs); // init endpoint address var endpointAddress = new EndpointAddress(cm.ClientServiceAddress); // create context var clientServiceInstance = diContainer.GetLazyBoundInstance <IRemoteSideCommunicationHandler>().Value; var instanceContext = new InstanceContext((IRemoteSideCommunicationContract)clientServiceInstance); // create client var cscc = new WCFServiceClient(instanceContext, binding, endpointAddress); clientServiceInstance.AssignRemoteSide(cscc); // init client WCFHelper.ApplyWCFEndpointLimits(cscc.Endpoint, cm.ClientServiceMaxItemsInObjectGraph); ret = cscc; return(ret); }