消费WCF服务托管在Windows服务

如何通过消耗托管在Windows服务的WCF服务步骤过程, 详细的编码和指令表示如下。

一旦成功,我们可以创建代理类业务,并开始使用客户端应用程序。这里,显示使用IIS托管型消费。

添加 ServiceModel 参考。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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();
}
}
}

联系我们

邮箱 626512443@qq.com
电话 18611320371(微信)
QQ群 235681453

Copyright © 2015-2024

备案号:京ICP备15003423号-3