Beispiel #1
0
        private void voBtnTestMyMath_Click(object sender, EventArgs e)
        {
            IMyMath im = new  ChannelFactory <IMyMath>(new BasicHttpBinding( ),
                                                       new EndpointAddress("http://localhost:8700/MM")).CreateChannel( );
            double result = im.ComputeAvg(7, 12, 14);

            MessageBox.Show("Result = " + result.ToString( ));
            (( IChannel )im).Close( );
        }
        private void btnTestWCFMyMath_Click(object sender, EventArgs e)
        {
            // We can use ChannelFactory to communicate with the Service
            // We do need to know the interface
            IMyMath im = new ChannelFactory <IMyMath>(new BasicHttpBinding(),
                                                      new EndpointAddress("http://localhost:8700/MM")).CreateChannel();
            double result = im.ComputeAvg(7, 12, 14);

            MessageBox.Show("Result = " + result.ToString());
            ((IChannel)im).Close();
        }