/// <summary> /// /// </summary> static void StartHosting() { string path = System.IO.Path.GetDirectoryName(typeof(Program).Assembly.Location); WcfTcpServer server = new WcfTcpServer(); foreach (string dll in System.IO.Directory.GetFiles(path, "*.dll")) { try { server.LoadInterfaceAssembly(System.Reflection.Assembly.LoadFile(dll)); } catch (Exception e_) { Console.WriteLine(e_.Message); } } foreach (string dll in System.IO.Directory.GetFiles(path, "*.dll")) { try { server.LoadImplAssembly(System.Reflection.Assembly.LoadFile(dll)); } catch (Exception e_) { Console.WriteLine(e_.Message); } } server.Start(); System.Threading.Thread.Sleep(-1); }
private void StartHosting() { string path = Path.GetDirectoryName(typeof (Program).Assembly.Location); _server = new WcfTcpServer(WcfServiceSection.Instance.Host.IP, WcfServiceSection.Instance.Host.Port); foreach (string fullName in from DllElement item in WcfServiceSection.Instance.Items select string.Format("{0}\\{1}", path, item.DllName)) { try { _server.LoadInterfaceAssembly(Assembly.LoadFile(fullName)); } catch (Exception e) { Log.Error(e); } } foreach (string fullName in from DllElement item in WcfServiceSection.Instance.Services select string.Format("{0}\\{1}", path, item.DllName)) { try { _server.LoadImplAssembly(Assembly.LoadFile(fullName)); } catch (Exception e) { Log.Error(e); } } _server.Start(); Thread.Sleep(-1); }