/// <summary> /// Initializes a new instance of the <see cref="RemotingServiceHelper"/> class. /// </summary> /// <param name="channelType">Type of the channel.</param> /// <param name="serverAddress">The server address.</param> /// <param name="serverPort">The server port.</param> public RemotingServiceHelper(RemotingChannelType channelType, string serverAddress, int serverPort) { this.channelType = channelType; this.serverAddress = serverAddress; this.serverPort = serverPort; Init(); }
/// <summary> /// Initializes a new instance of the <see cref="RemotingClientHelper"/> class. /// </summary> /// <param name="channelType">Type of the channel.</param> /// <param name="serverAddress">The server address.</param> /// <param name="serverPort">The server port.</param> /// <param name="callbackPort">The callback port.</param> public RemotingClientHelper(RemotingChannelType channelType, string serverAddress, int serverPort, int callbackPort) { this.channelType = channelType; this.serverAddress = serverAddress; this.serverPort = serverPort; this.callbackPort = callbackPort; Init(); }
public RemotingServiceObjectFactory() { // go through the parts... foreach (string part in EnterpriseApplication.Application.ConnectionStringParts.Keys) { // check... switch (part.ToLower()) { case "appname": RemoteAppName = (string)EnterpriseApplication.Application.ConnectionStringParts[part]; break; case "servername": RemoteServerName = (string)EnterpriseApplication.Application.ConnectionStringParts[part]; break; case "port": RemotePort = Int32.Parse((string)EnterpriseApplication.Application.ConnectionStringParts[part]); break; case "protocol": string protocol = (string)EnterpriseApplication.Application.ConnectionStringParts[part]; switch (protocol.ToLower()) { case "tcp": ChannelType = RemotingChannelType.Tcp; break; case "http": ChannelType = RemotingChannelType.Http; break; default: throw new NotSupportedException("Channel type '" + protocol + "' not supported."); } break; } } // did we get everything? if (RemoteAppName == "") { throw new RemotingConnectionException("You must provide a remote application name"); } if (RemoteServerName == "") { throw new RemotingConnectionException("You must provide a remote server name"); } if (RemotePort == 0) { throw new RemotingConnectionException("You must provide a remote port"); } }
public RemotingServiceObjectFactory() { // go through the parts... foreach(string part in EnterpriseApplication.Application.ConnectionStringParts.Keys) { // check... switch(part.ToLower()) { case "appname": RemoteAppName = (string)EnterpriseApplication.Application.ConnectionStringParts[part]; break; case "servername": RemoteServerName = (string)EnterpriseApplication.Application.ConnectionStringParts[part]; break; case "port": RemotePort = Int32.Parse((string)EnterpriseApplication.Application.ConnectionStringParts[part]); break; case "protocol": string protocol = (string)EnterpriseApplication.Application.ConnectionStringParts[part]; switch(protocol.ToLower()) { case "tcp": ChannelType = RemotingChannelType.Tcp; break; case "http": ChannelType = RemotingChannelType.Http; break; default: throw new NotSupportedException("Channel type '" + protocol + "' not supported."); } break; } } // did we get everything? if(RemoteAppName == "") throw new RemotingConnectionException("You must provide a remote application name"); if(RemoteServerName == "") throw new RemotingConnectionException("You must provide a remote server name"); if(RemotePort == 0) throw new RemotingConnectionException("You must provide a remote port"); }
/// <summary> /// 从配置文件加载配置值 /// </summary> /// <param name="node"></param> public void LoadValuesFromConfigurationXml(XmlNode node) { if (node == null) { return; } foreach (XmlNode n in node.ChildNodes) { if (n.NodeType == XmlNodeType.Comment) { continue; } if (n.Name == "server") { XmlAttributeCollection ac = n.Attributes; this._ChannelType = ac["channelType"].Value.ToLower() == "tcp" ? RemotingChannelType.Tcp : RemotingChannelType.Http; this._ServerAddress = ac["serverAddress"].Value; this._Port = Convert.ToInt32(ac["port"].Value); } if (n.Name == "remoteObject") { XmlAttributeCollection ac = n.Attributes; ServiceModule module = new ServiceModule(); module.Name = ac["name"].Value; module.AssemblyName = ac["assemblyName"].Value; module.ClassName = ac["className"].Value; if (string.IsNullOrEmpty(ac["mode"].Value)) { module.Mode = ac["mode"].Value.ToLower() == "singleton" ? WellKnownObjectMode.Singleton : WellKnownObjectMode.SingleCall; } this._Modules.Add(module); } } }
/// <summary> /// Initializes a new instance of the <see cref="RemotingServerHelper"/> class. /// </summary> /// <param name="channelType">Type of the channel.</param> /// <param name="serverAddress">The server address.</param> /// <param name="serverPort">The server port.</param> public RemotingServerHelper(RemotingChannelType channelType, string serverAddress, int serverPort) { this.channelType = channelType; this.serverAddress = serverAddress; this.serverPort = serverPort; Init(); }
/// <summary> /// 从配置文件加载配置值 /// </summary> /// <param name="node"></param> public void LoadValuesFromConfigurationXml(XmlNode node) { if (node == null) return; foreach (XmlNode n in node.ChildNodes) { if (n.NodeType == XmlNodeType.Comment) continue; if (n.Name == "server") { XmlAttributeCollection ac = n.Attributes; this._ChannelType = ac["channelType"].Value.ToLower() == "tcp" ? RemotingChannelType.Tcp : RemotingChannelType.Http; this._ServerAddress = ac["serverAddress"].Value; this._Port = Convert.ToInt32(ac["port"].Value); } if (n.Name == "remoteObject") { XmlAttributeCollection ac = n.Attributes; ServiceModule module = new ServiceModule(); module.Name = ac["name"].Value; module.AssemblyName = ac["assemblyName"].Value; module.ClassName = ac["className"].Value; if (string.IsNullOrEmpty(ac["mode"].Value)) { module.Mode = ac["mode"].Value.ToLower() == "singleton" ? WellKnownObjectMode.Singleton : WellKnownObjectMode.SingleCall; } this._Modules.Add(module); } } }