public TcpHostedTransportConfiguration() : base(Uri.UriSchemeNetTcp) { string[] bindings = HostedTransportConfigurationManager.MetabaseSettings.GetBindings(Uri.UriSchemeNetTcp); for (int i = 0; i < bindings.Length; i++) { BaseUriWithWildcard baseAddress = BaseUriWithWildcard.CreateHostedUri(Uri.UriSchemeNetTcp, bindings[i], HostingEnvironmentWrapper.ApplicationVirtualPath); if (i == 0) { this.uniqueManager = new HostedTcpTransportManager(baseAddress); } base.ListenAddresses.Add(baseAddress); TcpChannelListener.StaticTransportManagerTable.RegisterUri(baseAddress.BaseAddress, baseAddress.HostNameComparisonMode, this.uniqueManager); } }
protected override void OnStart() { TcpHostedTransportConfiguration configuration = HostedTransportConfigurationManager.GetConfiguration(Uri.UriSchemeNetTcp) as TcpHostedTransportConfiguration; transportManager = configuration.TransportManager as HostedTcpTransportManager; transportManager.Start(listenerChannelContext.ListenerChannelId, listenerChannelContext.Token, OnMessageReceived); }