RemoteObjectX
This is a .Net Service - transactional and poolable object register into the COM+ catalog and config as a remoting object. There are attributes for assembly and class necessary for this object configuration in the COM+ catalog. The other change, the remote class is derived from the ServicedComponent. This is a standard stuff for the .Net Service configuration.
using RKiss.RemoteObject; // abstract definitions
[assembly: ApplicationName("RemoteObjectX")]
[assembly: ApplicationID("026B9E80-6B07-45f0-8EBF-BD35B5D3BB77")]
[assembly: Description("Remoting COM+ test")]
[assembly: ApplicationActivation(ActivationOption.Library)] // accepted by Beta2
[assembly: ApplicationAccessControl(Value = false, Authentication = AuthenticationOption.None)]
namespace RKiss.RemoteObjectX
{
[Guid("B19A2AD2-31F2-4c6e-B5A6-24495670BE02")]
[Description("Remoting Object")]
[ObjectPooling(Enabled=true,MinPoolSize=3,MaxPoolSize=64)]
[Transaction(TransactionOption.Required)]
[ConstructionEnabled(Default="server=ATZ-ROMAN;uid=sa;pwd=;database=Logger")]
[EventTrackingEnabled]
public class RmObjectX : ServicedComponent, IRmObject
{
...
}
}
Note that object has to run in the COM+ library only, that's the limitation of the Beta2 and it will be fix it in the RTM version.
RemoteObjectWS
This is a Web Service object generated by wizard and modify for the remoting purpose. The following code snippet shows its boilerplate:
using RKiss.RemoteObject; // abstract definitions
namespace RemoteObjectWS
{
public class RmObjectWS : MarshalByRefObject, IRmObject
{
public RmObjectWS()
{
...
}
#region Component Designer generated code
...
#endregion
[WebMethod]
public string Echo(string msg)
{
...
}
// stateless callbacks
[WebMethod]
public string GiveMeCallback(int timeinsec, string ticketId, object objwire)
{
...
}
}
}
Note that this project has to be unzip and move it into the localhost\RemoteObjectWS directory in prior of opening the solution.
HostServer
This is a server program to host a remote object. It's a very simply console program to perform a configuration of the remote object(s). There are two kinds of options for this configuration as I mentioned earlier. The option 1 is commented.
namespace RKiss.ServerActivation
{
public class Server
{
public static int Main(string [] args)
{
try
{
/* option 1
TcpChannel chan = new TcpChannel(12345);
ChannelServices.RegisterChannel(chan);
RemotingConfiguration.RegisterWellKnownServiceType(
Type.GetType("RKiss.RemoteObjectA.RmObjectA, RemoteObjectA"),
@"RemoteTest/ObjectA",
WellKnownObjectMode.SingleCall);
RemotingConfiguration.RegisterWellKnownServiceType(
Type.GetType("RKiss.RemoteObjectX.RmObjectX, RemoteObjectX"),
@"RemoteTest/ObjectX",
WellKnownObjectMode.Singleton);
*/
// option 2
RemotingConfiguration.Configure(@"..\..\HostServer.exe.config");
}
catch(Exception ex)
{
System.Console.WriteLine(ex.Message);
}
System.Console.WriteLine("Hit <enter> to exit...");
System.Console.ReadLine();
return 0;
}
}
}
|
|