|
Reflection + Remoting
|
|||
---|---|---|---|
#18+
Вот код. Сервер: RemotingConfiguration.Configure("server.config.xml"); System.Console.WriteLine("Press Enter"); System.Console.ReadLine(); server.config.xml <configuration> <system.runtime.remoting> <application> <channels> <channel ref="http" port="4001" /> </channels> <lifetime leaseTime="10MS" renewOnCallTime="10MS" leaseManagerPollTime = "5MS" /> <service> <wellknown mode="SingleCall" type="TDZS_Server_4001.ServerClass1, TDZS_Server_4001" objectUri="Server1.soap" /> </service> </application> </system.runtime.remoting> </configuration> Клиент: Object obj = RemotingHelper.CreateRemoteObject((RemoteObjects)comboBox1.SelectedIndex); MethodInfo mi = RemotingHelper.RemoteType.GetMethod(ConfigReader.GetMethodForRemoteObject((RemoteObjects)comboBox1.SelectedIndex)); try { MessageBox.Show(mi.Invoke(obj, null).ToString(), "Result", MessageBoxButtons.OK, MessageBoxIcon.None); } catch (Exception ex) { MessageBox.Show(ex.Message,"Error",MessageBoxButtons.OK,MessageBoxIcon.Error); } плюс вспомагательный класс public static class RemotingHelper { private static Type _t = null; private static System.Reflection.Assembly a = System.Reflection.Assembly.Load("TDZS_Service"); public static Object CreateRemoteObject(RemoteObjects RemObj) { string type = ConfigReader.GetInterfaceForRemoteObject(RemObj); _t = a.GetType(type); Object obj = null; obj = Activator.GetObject(_t, ConfigReader.GetUrlForRemoteObject(RemObj)); return obj; } public static Type RemoteType { get { return _t; } } } И сервер и клиент используют промежуточную библиотеку(dll), причем у сервака своя копия этой длл и на клиенте своя копия длл. У меня возникает вот такая ошибка, которая возникает на стороне сервака. Attempted to read or write protected memory. This is often an indication that other memory is corrupt. Что делать? ПАМАГИТЕ!!! ... |
|||
:
Нравится:
Не нравится:
|
|||
03.04.2006, 16:47 |
|
Reflection + Remoting
|
|||
---|---|---|---|
#18+
Забыл сказать, что эта ошибка возникает после закрытия клиентского приложения. ... |
|||
:
Нравится:
Не нравится:
|
|||
03.04.2006, 16:48 |
|
|
start [/forum/topic.php?fid=19&fpage=37&tid=1398103]: |
0ms |
get settings: |
11ms |
get forum list: |
13ms |
check forum access: |
4ms |
check topic access: |
4ms |
track hit: |
34ms |
get topic data: |
13ms |
get forum data: |
3ms |
get page messages: |
45ms |
get tp. blocked users: |
2ms |
others: | 14ms |
total: | 143ms |
0 / 0 |