Static methods can not be called remotely

 


The client application can not access to static methods / properties / fields remotely. Since you access a static method using CLASSNAME.STATICMETHOD, instead of OBJREF.STATICMETHOD, there’s no proxy involved. So access to static methods always takes place in the client’s context.

 

But you can add a thin non-static wrapper around each static method in order to remote calling.

 

Take the following code snippet as an example:

public class MyClass : MarshalByRefObject

 {

   public static void DoSomething (...) // Can not be called remotely

   {

     ...

   }

 

   public void DoSomethingWrapper (...) // Can be called remotely

   {

     DoSomething (...);

   }

 }

 


 Refer to the articles as follows to get more information:

1. http://www.cnblogs.com/rickie/archive/2004/10/13/51500.html


 

 

 

相关文章:

  • 2021-06-23
  • 2022-12-23
  • 2022-03-09
  • 2022-12-23
  • 2022-01-11
  • 2022-12-23
  • 2022-12-23
  • 2021-12-05
猜你喜欢
  • 2022-12-23
  • 2022-01-19
  • 2022-02-20
  • 2022-12-23
  • 2022-12-23
  • 2021-06-15
  • 2021-10-21
相关资源
相似解决方案