110,571
社区成员
发帖
与我相关
我的任务
分享
[STAThread]
public static void Main(string[] args) {
try {
Console.WriteLine("input the two summands");
Console.WriteLine("sum1:");
double sum1 = Double.Parse(Console.ReadLine());
Console.WriteLine("sum2:");
double sum2 = Double.Parse(Console.ReadLine());
string fileName = @"..\server\ior";
if (args.Length > 0) {
fileName = args[0];
}
TextReader reader = new StreamReader(fileName);
string ior = reader.ReadLine();
reader.Close();
Console.WriteLine("use ior: " + ior.ToString());
IDictionary props = new Hashtable();
props[IiopChannel.CHANNEL_NAME_KEY] = "IiopClientChannelSsl";
props[IiopChannel.TRANSPORT_FACTORY_KEY] =
"Ch.Elca.Iiop.Security.Ssl.SslTransportFactory,SSLPlugin";
props[SslTransportFactory.CLIENT_AUTHENTICATION] =
"Ch.Elca.Iiop.Security.Ssl.ClientMutualAuthenticationSuitableFromStore,SSLPlugin";
// take certificates from the windows certificate store of the current user
props[ClientMutualAuthenticationSuitableFromStore.STORE_LOCATION] =
"CurrentUser";
// the expected CN property of the server key
props[DefaultClientAuthenticationImpl.EXPECTED_SERVER_CERTIFICATE_CName] =
"IIOP.NET demo server";
// register the channel
IiopClientChannel channel = new IiopClientChannel(props);
ChannelServices.RegisterChannel(channel, false);
// get the reference to the adder
Adder adder = (Adder)RemotingServices.Connect(typeof(Adder), ior);
// call add
double result = adder.add(sum1, sum2);
Console.WriteLine("result: " + result);
} catch (Exception e) {
Console.WriteLine("exception: " + e);
}
}
做过是在网上找到的demo,我也是仿照做的,普通模式的话 ok,但是
IiopClientChannel channel = new IiopClientChannel(props);
一旦加入 props 参数 就报错 :CORBA system exception : omg.org.CORBA.COMM_FAILURE, completed: Completed_MayBe minor: 209
在我本地 我只是改了以下参数 ,换成了自己的,是我换错了么?
props[IiopChannel.CHANNEL_NAME_KEY] = "IiopClientChannelSsl";
// the expected CN property of the server key
props[DefaultClientAuthenticationImpl.EXPECTED_SERVER_CERTIFICATE_CName] =
"IIOP.NET demo server";