构造函数有参数的远程对象,怎样调用? RegisterWellKnownClientType可以传入不同的参数。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 構造函數有參數的遠程對象,客戶端調用只能用Activator.CreateInstance(...)來創建本地引用副本,不能夠用new.這和激活類型沒有關係 From MSDN==========================================================ObjectHandle hdlSample;IMyExtenderInterface myExtenderInterface;string argOne = "Value of argOne";int argTwo = 7;object[] args = {argOne, argTwo};// Uses the UrlAttribute to create a remote object.object[] activationAttributes = {new UrlAttribute("http://localhost:9000/MySampleService")};// Activates an object for this client.hdlSample = Activator.CreateInstance("SampleAssembly", "samplenamespace.sampleclass", true, BindingFlags.Instance|BindingFlags.Public, null, args, null, activationAttributes, null);myExtenderInterface = (IMyExtenderInterface)hdlSample.Unwrap();Console.WriteLine(myExtenderInterface.SampleMethod("Bill")); EntityFramework + sqlite 的几个问题 C#中int[][]和int[,]有什么区别? 请问,这种轮询功能如何实现? 如何实现自动回复(discuz论坛) 有没有内存共享的例子 听说每天发布一个帖子,可以拿30分?测试一下,呵呵 如何获得filelistbox中文件的个数? C# 删除网络驱动器 做一个ftp客户端,用netstream向服务器发送ftp命令,但是时而成功时而失败,怎么回事? 怎样创建资源文件? 怎样给ComboBox赋初值?? c#怎么处理html属性
這和激活類型沒有關係
ObjectHandle hdlSample;
IMyExtenderInterface myExtenderInterface;
string argOne = "Value of argOne";
int argTwo = 7;
object[] args = {argOne, argTwo};
// Uses the UrlAttribute to create a remote object.
object[] activationAttributes = {new UrlAttribute("http://localhost:9000/MySampleService")};
// Activates an object for this client.
hdlSample = Activator.CreateInstance("SampleAssembly",
"samplenamespace.sampleclass",
true,
BindingFlags.Instance|BindingFlags.Public,
null,
args,
null,
activationAttributes,
null);
myExtenderInterface = (IMyExtenderInterface)hdlSample.Unwrap();
Console.WriteLine(myExtenderInterface.SampleMethod("Bill"));