Exam exam article: https://www.microsoft.com/china/msdn/library/architecture/architecture/architecturetopic/BuildSucApp/BSAAsecmodsecmod29.mspx? Mfr = true
1. First, define the method that the program object needs to operate on. This interface is set to a simple class for reference by windowsservice and programming client.
Public interface IRemoteObjectMethod
{
Void dosomething ();
}
2. Then, create a windows service Project and add the classes of the actual program object interface.
Public class RemoteObject: MarshalByRefObject, IRemoteObjectMethod
{
Public RemoteObject ()
{}
// Examples of Adding Methods
}
3. Add strongswan program object configuration to app. config.
As follows:
<System. runtime. remoting>
<Application name = "ServerToClientService">
<Service>
<Wellknow type = "downloaderservice. externaldownsyncobject, downloaderservice" objecturi = "downsyncobject" mode = "singlecall"/>
</Service>
<Channels>
<Channel ref = "TCP" Port = "6767">
<Serverproviders>
<Formatter ref = "binary"/>
</Serverproviders>
</Channel>
</Channels>
</Application>
</System. runtime. remoting>
4. In the start method of Windows Service, add the replacement of the photo upload program.
Protected override void onstart (string [] ARGs)
{
RemotingConfiguration. Configure (AppDomain. CurrentDomain. SetupInformation. ConfigurationFile );
}
5. Install windows server. You don't have to renew it.
At this point, the windows service has been completed, and all subsequent operations are performed on the shuttle bus.
6. Add the category and configuration file for retrieving the processed object.
Public class RemoteObjectFactory
{
// Specify the service name of the target image
Private static string svc_Name = ConfigurationSettings. deleettings ["ServiceName"];
// The IP address of the Local Service
Private static string svc_ipAddress = ConfigurationSettings. deleettings ["ServiceIP"];
// Specifies the port used when the program processes the image.
Private Static int svc_port = int. parse (configurationsettings. deleettings ["serviceport"]);
// Identification of the entire process on the Image
Private Static string svc_objecturi = configurationsettings. deleettings ["objecturi"];
// Type of the router interface
Private Static string channeltype = configurationsettings. deleetask[ "channeltype"];
Public static iremoteobjectmethod getserversyncobject ()
{
String url = channeltype + ": //" + svc_ipaddress + ":" + svc_port.tostring () + "/" + svc_name + "/" + svc_objecturi;
IRemoteObjectMethod obj = (IRemoteObjectMethod) Activator. GetObject (typeof (IRemoteObjectMethod), url );
If (obj = null)
{
Throw new Exception ("Service not exists or Remoteobject not exists! ");
}
Return obj;
}
}
The method used to create the upload process for image mirroring, and add the corresponding configuration scheme in app. config.
7. Use the guest terminal to renew the client.
IRemoteObjectMethod remoteObject = RemoteObjectFactory. GetServerSyncObject ();
RemoteObject. dosomething ();
In this way, it seems that it can be used better than the actual progress method of linear regression :)