예제 #1
0
 public void TestWebServiceStartStop()
 {
     using (Reference <ILogger> loggerRef = Reference <ILogger> .Create(new TraceLogger(true)))
     {
         using (var coreServer = new CoreServer(loggerRef, "UTT", NodeType.Router))
         {
             coreServer.Start();
             using (Reference <ICoreClient> clientRef = Reference <ICoreClient> .Create(new CoreClientFactory(loggerRef).SetEnv("UTT").Create()))
                 using (var httpServer = new WebProxyServer())
                 {
                     httpServer.LoggerRef = loggerRef;
                     httpServer.Client    = clientRef;
                     httpServer.Start();
                 }
         }
     }
 }
예제 #2
0
 static void Main(string[] args)
 {
     using (Reference <ILogger> loggerRef = Reference <ILogger> .Create(new ConsoleLogger(null)))
     {
         try
         {
             using (Reference <ICoreClient> client = Reference <ICoreClient> .Create(new CoreClientFactory(loggerRef).SetEnv(BuildConst.BuildEnv).Create()))
                 using (IServerBase2 server = new WebProxyServer())
                 {
                     server.LoggerRef = loggerRef;
                     server.Client    = client;
                     server.Start();
                     loggerRef.Target.LogInfo("Running... Press ENTER to exit.");
                     Console.ReadLine();
                 }
         }
         catch (Exception excp)
         {
             loggerRef.Target.Log(excp);
             loggerRef.Target.LogInfo("Failed. Press ENTER to exit.");
             Console.ReadLine();
         }
     }
 }