예제 #1
0
        public void WfcServiceHost_Http()
        {
            // Verify that we can create a service instance and then call it.

            WcfServiceHost host;

            host = new WcfServiceHost(new TestService());
            try
            {
                host.AddServiceEndpoint(typeof(ITestService), @"binding=HTTP;uri=http://localhost:8008/Unit/Test.svc;settings=<wsHttpBinding><security mode=""None""/></wsHttpBinding>");
                host.ExposeServiceDescription(null, null);
                host.Start();

                TestServiceClient client;

                client = new TestServiceClient(new WSHttpBinding(SecurityMode.None), new EndpointAddress("http://localhost:8008/Unit/Test.svc"));
                client.Open();
                try
                {
                    client.Set("Hello World!");
                    Assert.AreEqual("Hello World!", client.Get());
                }
                finally
                {
                    client.Close();
                }
            }
            finally
            {
                host.Stop();
            }
        }
예제 #2
0
        public TestDto Get(string id)
        {
            TestDto test = testServiceClient.Get(id);

            return(test);
        }