Recently, I tried to use Remoting to distribute application development, there were some small errors, which made me walked a lot of detours, and now records. 1. Discovery server activation object supports the constructor without parameters, so it is changed to the client to activate the object; 2, the client activation object can be http: //localhost/*.soap? WSDL method Check if the remote object is configured, the client activation object does not support this way; 3, I don't know if the remote recoting object is still a local object, check the object if the object is a proxy object, if (RemotingServices.IstransparentProxy (obj) ) {Console.WriteLine ( "transparent proxy"); RealProxy proxy = RemotingServices.GetRealProxy (obj); Console.WriteLine (proxy.ToString ());} 4, with an indication of the sequence of objects and inherit from the serializable attribute System.MarshalByRefObject, Errors; 5, client components and remote components (with IIS bearer, located in bin directory in sites) inconsistent, errors; 6 I have been looking for problems with whether or not; if it is determined whether the transmitted object can be serialized, use the following code inspection, discovery that the local serialization component is not problematic; // Reverse sequenced object public static object deser () {Object Info; iformatter Formatter = new binaryformatter ();
Stream Stream = New FileStream ("Sam.dat", FileMode.open, FileAccess.Read, Fileshare.none; info = formatter.deserialize;
stream.close ();
Return INFO;
}
// Serialized Object PUBLIC STATIC VOID SER (Object Info) {iformatter formatter = new binaryformatter ();
Stream Stream = New FileStream ("Sam.dat", FileMode.create, FileAccess.write, Formatter.Serialize (Stream, Info);
Stream.close ();} 7, for the error "due to security restrictions, the object cannot be accessed", finally discovered that a strong name is added due to the components of the serialized object, causing an error. This error will not appear if you go to a strong name. This problem plagues me for two days. Start thinking that my transotization configuration is basically, and some problems have recently occurred, and their simple exploration and practice is recorded. 8, found that its database connection class ConnectionInfo does not serve as a parameter in Web Service. Because of CultureInfo, it is impossible to implement sequentialization (because CultureInfo does not implement the iSerializable interface), then change the type to String Since Remoting calls the remote object, it is inconvenient to debug, so you can first use the desired class Web service to debug, and it is also a method of debugging Remoting; 9, the previous error "Due to security restrictions, it is impossible to access Object "error, and the name of the name, in fact, it is not a real solution; can be set by setting typefilterLevel =" full "in the configuration file, the client and server-side profiles need to be set. See: http://www.thinktecture.com/resources/remotingfaq/changes2003.htmlyou Can do this Either by useing a configuration file like this (for server side):
serverproviders>
clientProviders>
CHANNEL>
channels>
service>
application>
configure>
In this Case, a Matching Client-Side Configuration File Which Allows The Reception of Events and Callbacks, Would Look Like this:
clientProviders>
serverproviders>
CHANNEL>
channels>
client>
application>
configuration> 10, after the modification of the configuration file is performed in accordance with the above format, it has finally do not appear "Due to secure limitations, unacceptable objects" error, but "MscorLib.dll appears in the eventual type of exception type system.Runtime". SERIALIZATION. SERIALIZATIONEXCEPTION. Other information: Binaryformatter version is not compatible. The received version is 1008738336.1684104552 "error, this error is" not "because the version is not compatible, but because the client cannot analyze the wrong response of the text format. In order to real error message, I change the format program from binary to soap. 11, the same as the class ConnectionInfo that needs to be serialized, is added to the configuration file (
In the client configuration file), haha, finally passed. (However, I still didn't understand why the serial class should also be configured?) 12, discover static (static) method even if the remote configuration is performed, the call is actually the way, it seems that if you need to call the remote STATIC method, only Then package into an instance method for the client call.