private static void ServerFaulted(object sender, EventArgs e)
 {
     if (MainForm != null)
     {
         WcfServer           = new WcfServer("JBS_YTMusicUploader");
         WcfServer.Received += ProcessWcfMessage;
         WcfServer.Faulted  += ServerFaulted;
         WcfServer.Start();
     }
 }
Exemple #2
0
        static void Main(string[] args)
        {
            string filename = AppDomain.CurrentDomain.BaseDirectory + "config\\catclient.xml";

            Cat.Initialize(filename);

            WcfServer server = WcfServer.GetInstance();

            server.WcfFaultedEvent    += new WcfFaulted(server_WcfFaultedEvent);
            server.WcfClosedEvent     += new WcfClosed(server_WcfClosedEvent);
            server.WcfBeforeCallEvent += new WcfBeforeCall(server_WcfBeforeCallEvent);
            server.WcfAfterCallEvent  += new WcfAfterCall(server_WcfAfterCallEvent);
            server.Start();
            Console.WriteLine("服务启动...");

            Console.ReadKey();

            server.Stop();
        }
        public void Calling_dispose_on_a_WcfClient_should_not_throw_EndpointNotFoundException()
        {
            // start the server
            var wcfServer = new WcfServer();

            wcfServer.Start();

            // create the client and test it
            var client = new WcfClient(new WcfChannel <IMessageProcessor>(wcfServer.EndpointAddress), "testclient");

            Assert.DoesNotThrow(() =>
            {
                var response = client.EchoMessage("teszt");
                Assert.IsInstanceOf <EchoResponse>(response);
                Assert.That(((EchoResponse)response).Message, Is.StringContaining("Echo: teszt"));
            });

            // now stop the server and dispose the client and check if it throws
            wcfServer.Stop();
            Assert.DoesNotThrow(client.Dispose);
        }
Exemple #4
0
        protected override void OnStart(string[] args)
        {
            server = WcfServer.GetInstance();

            server.Start();
        }
Exemple #5
0
        private void Form1_Load(object sender, EventArgs e)
        {
            server = WcfServer.GetInstance();

            server.Start();
        }