1. Create a blank solution
2. Create a class library and add an interface idata
3. Create a class library, add a subclass of externalbyrefobject, and implement the interface idata
4. Create a service website and apply it globallyProgramRegister remoting with global. asax in the domain
Reference namespace
<% @ Import namespace = "system. runtime. remoting" %>
<% @ Import namespace = "system. runtime. remoting. channels" %>
<% @ Import namespace = "system. runtime. remoting. channels. http" %>
Idictionary httpprop = new hashtable ();
Httpprop ["name"] = "passportsrv ";
Httpprop ["Priority"] = "100 ";
Ichannel channel = new httpchannel (httpprop, null, null );
Channelservices. registerchannel (Channel, true );
Remotingconfiguration. registerwellknownservicetype (typeof (space. Class Name), "***. Rem", wellknownobjectmode. singlecall );
5. Add URI to the Web. config file of the client website
<Add key = "url name" value = "http: // ip or local machine (localhost: 1020)/Server website name/registered. Rem"/>
Create a class to use remoting
Remoteserver. CS
// Member
Private Static string _ idataurl;
Private Static interface _ idatasrv;
// Attributes
Public static idata remoteproxy
{< br> Get
{< br> // application server address
If (webconfigurationmanager. appsettings ["url name"]! = NULL)
_ idataurl = webconfigurationmanager. deleetask[ "url name"];
else
throw new applicationexception ("the application server address is not configured, Please configure the passportsrv item");
If (_ idatasrv = NULL)
{
_ Idatasrv = (idata) activator. GetObject (typeof (idata), _ idataurl );
}
If (null = _ idatasrv)
{
Throw new applicationexception ("an application server object cannot be created ");
}
Return _ idatasrv;
}
}
Now you can use the methods in the interface to operate data from the server.