<!-- This endpoint is exposed at the base address provided by host: http://localhost/servicemodelsamples/service.svc --> <endpoint address="" binding="wsHttpBinding" contract="Microsoft.ServiceModel.Samples.ICalculator" />
<!-- The mex endpoint is exposed at http://localhost/servicemodelsamples/service.svc/mex --> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> </service> </services> <bindings> <wsHttpBinding> <binding> <security mode="None"/> </binding> </wsHttpBinding> </bindings> <behaviors> <serviceBehaviors> <behavior name="CalculatorServiceBehaviors"> <!-- Add the following element to your service behavior configuration. --> <serviceMetadata httpGetEnabled="true" /> <useRequestHeadersForMetadataAddress> <defaultPorts> <add scheme="http" port="8081" /> <add scheme="https" port="8081" /> </defaultPorts> </useRequestHeadersForMetadataAddress> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel>
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using IISCalculator.ServiceReference1;
namespace IISCalculator { class Program { static void Main(string[] args) { CalculatorClient client = new CalculatorClient(); double value1 = 100.00D; double value2 = 39.9D; double reuslt = client.Add(value1, value2); Console.WriteLine("value1:{0} add value2:{1} is : {2}",value1,value2,reuslt); Console.Read(); } } }
using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using WcfMysqlClient.ServiceReference1;
namespace WcfMysqlClient { /// <summary> /// MainWindow.xaml 的交互逻辑 /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); this.DataGrid.ItemsSource = GetTable().DefaultView; }
DataTable GetTable() { MysqlInfoClient client = new MysqlInfoClient(); var table = client.GetDataSet(); return table.Tables[0]; } } }