Author: zfive5 email: zfive5@yahoo.com.cn
Just ".NET Remoting Programming", the Remote client program in the text directly uses the first step to generate libraries is wrong, so it is quite exposed to the user, open it with Ildasm.exe! Look at the realization logic of the method, there is no such thing, and even the shame is not ... It is used as an entry-level article to be used directly, but it is necessary to indicate the drawback here. Don't let your readers ignore this! Safety of the Remoting system for their future!
C # code: Using system; Namespace Testdll {///
Public Int Add (int A, int b) {RETURN A B;}}}
The anti-compiled MSIL code under ildasm.exe:
.method public hidebysig instance int32 add (int32 a, int32 b) CIL managed {// code size 8 (0x8) .maxstack 2 .locals init ([0] int32 cs $ 00000003 $ 000000) IL_0000: ldarg.1 IL_0001: ldarg.2 IL_0002: Add IL_0003: STLOC.0 IL_0004: Br.s IL_0006 IL_0006: LDLOC.0 IL_0007: Ret} // end of method zf5 :: add
INT32 ZF5 :: Add (int32 a, int32 b) realizes the code list! If this is a encrypted or authentication code, what should you do?
Now thinking about it ...
MSDN About it is as follows:
Since the client requires type information of the remote type, simply deploy the remote type library to the client to act as a metadata is usually the easiest way. However, in many cases, you don't want any client to have access to this type. Several methods can solve this problem:
1. Create a separate client according to the SOAPSUDS Tool (SOAPSUDS.EXE) as described in the separate client topic. This is only applicable to HTTPChannel objects. 2. Deploy an assembly containing only metadata (this assembly with the server assembly) and disables version check or a blank version of the version.
3. Declare an interface in another library and deploy the library to the client. Publish a server class that implements the interface; the client will be able to use this class by getting the agent of the interface implemented.
Note that the client will have to call the Activator.getObject method to get the agent. Calling New (NEW in Visual Basic) will raise compile time errors; unable to create an instance of the interface.
4. Generate a remote processing packaging class for a real class. Publish and deploy packaging libraries. The client will not have access to the real object.