如何通过消耗托管在Windows服务的WCF服务步骤过程, 详细的编码和指令表示如下。
一旦成功,我们可以创建代理类业务,并开始使用客户端应用程序。这里,显示使用IIS托管型消费。
添加 ServiceModel 参考。
using System; |
using System.Collections.Generic; |
using System.Linq; |
using System.Text; |
namespaceWindowServiceClient |
{ |
classProgram |
{ |
staticvoid Main(string[] args) |
{ |
//Creating Proxy for the MyService |
MyServiceClient client = newMyServiceClient(); |
Console.WriteLine("Client calling the service..."); |
Console.WriteLine("Sum of two numbers 5,6"); |
Console.WriteLine(client.Add(5, 6)); |
Console.WriteLine("Subtraction of two numbers 6,5"); |
Console.WriteLine(client.Add(6, 5)); |
Console.WriteLine("Multiplication of two numbers 6,5"); |
Console.WriteLine(client.Add(6, 5)); |
Console.WriteLine("Division of two numbers 6,3"); |
Console.WriteLine(client.Add(6, 3)); |
Console.Read(); |
} |
} |
} |