Пример #1
0
        static ProtoHandler()
        {
            var config = (ProtoConfigurationSection)WebConfigurationManager.GetSection("protoChannel");

            if (config == null)
                throw new ProtoChannelException("No protoChannel configuration section has been provided");

            string hostName = config.Host;
            int hostPort = config.Port;

            string hostEndPoint = WebConfigurationManager.AppSettings["protochannel.host"];

            if (hostEndPoint != null)
            {
                string[] parts = hostEndPoint.Split(new[] { ':' }, 2);
                if (parts.Length == 2)
                {
                    int port;

                    if (
                        int.TryParse(parts[1], NumberStyles.None, CultureInfo.InvariantCulture, out port) &&
                        port > 0
                    )
                    {
                        hostName = parts[0];
                        hostPort = port;
                    }
                }
            }

            if (hostName == null || hostPort <= 0)
                throw new ProtoChannelException("No host and port have been provided; specify them either in the protoChannel config section or through the protochannel.host appSetting");

            Proxy = new ProtoProxyHost(hostName, hostPort, Assembly.Load(config.ServiceAssembly));
        }
Пример #2
0
        public CallbackChannel(ProtoProxyHost host, string channelId)
        {
            Require.NotNull(host, "host");
            Require.NotNull(channelId, "channelId");

            _host = host;
            _channelId = channelId;
        }
Пример #3
0
        public ProtoProxyClient(ProtoProxyHost host, string key, ProtoClient client)
        {
            Require.NotNull(host, "host");
            Require.NotNull(key, "key");
            Require.NotNull(client, "client");

            _host = host;
            Key = key;
            Client = client;

            _lastInteraction = DateTime.Now;
        }