private static DeleporterService CreateInstance() { if (!_hasRegisteredChannel) { ChannelServices.RegisterChannel(new TcpChannel( new Hashtable { { "port", 0 }, { "typeFilterLevel", TypeFilterLevel.Full }, { "name", Guid.NewGuid().ToString() } }, new BinaryClientFormatterSinkProvider(), new BinaryServerFormatterSinkProvider { TypeFilterLevel = TypeFilterLevel.Full } ), false); RemotingConfiguration.RegisterWellKnownClientType(typeof(DeleporterService), DeleporterConfiguration.HostAddress); _hasRegisteredChannel = true; } var instance = new DeleporterService(); try { instance.RegisterAssemblyProvider(new AssemblyProvider()); } catch (SocketException socketException) { LoggerClient.Log("Failed to create a channel on port {0}", DeleporterConfiguration.RemotingPort); throw new Exception(string.Format("Deleporter client was unable to connect to the remoting port {0} to the server. Likely causes: 1) RemotingPort or WebHostPort settings are not the same in both projects; 2) WebServer may not have been able to listen on the remoting port because something else is using the port. Try using another port.", DeleporterConfiguration.RemotingPort), socketException); } LoggerClient.Log("Created remoting channel on port {0}", DeleporterConfiguration.RemotingPort); return(instance); }
private static DeleporterService CreateInstance() { if (!_hasRegisteredChannel) { ChannelServices.RegisterChannel(new TcpChannel( new Hashtable { { "port", 0 }, { "typeFilterLevel", TypeFilterLevel.Full }, { "name", Guid.NewGuid().ToString() } }, new BinaryClientFormatterSinkProvider(), new BinaryServerFormatterSinkProvider { TypeFilterLevel = TypeFilterLevel.Full } ), false); RemotingConfiguration.RegisterWellKnownClientType(typeof (DeleporterService), NetworkConfiguration.HostAddress); _hasRegisteredChannel = true; } var instance = new DeleporterService(); instance.RegisterAssemblyProvider(new AssemblyProvider()); return instance; }