public string GetServiceClassCode(string nameSpace, string className) { using (var netclient = new ProxyClient(ServiceTransaction.ProxyAddress, new NetAddress(_serviceLocation.Host, _serviceLocation.Port), ServiceTransaction.ServiceClientCertificate)) { netclient.WriteServiceData(new InvokeCommand() { Type = InvokeType.GenerateInvokeCode, Service = _serviceName, Parameters = new string[] { nameSpace, className } }); var ret = netclient.ReadServiceObject <InvokeResult <string> >(); if (!ret.Success) { throw new RemoteException(null, ret.Error); } return(ret.Data); } }
public static NetClient CreateClient(NetAddress proxy, NetAddress addr, X509Certificate2 cert) { var key = $"{addr.Address}--{addr.Port}"; NetClientSeat[] array; if (Dict.TryGetValue(key, out array) == false) { Dict.TryAdd(key, GetArray()); array = Dict[key]; } var freeitem = GetFree(array); if (freeitem == null) { freeitem = new ProxyClient(proxy, addr, cert); freeitem.KeepAlive = array.Any(m => m.Client == null); } return(freeitem); }