WCF - Consuming WCF Service
https://www.tutorialspoint.com/wcf/wcf_consuming_service.htm
WCF services allow other applications to access or consume them. A WCF service can be consumed by many ways depending on the hosting type. Here, we are explaining the step-by-step method to consume a WCF service for each of the following popular hosting options:
- Consuming WCF Service hosted in IIS 5/6
- Consuming WCF Service that is self-hosted
- Consuming WCF Service hosted in Windows Activation Service
- Consuming WCF Service hosted in Windows Service
Consuming WCF Service Hosted in IIS 5/6
The process of consumption of a WCF service hosted in IIS 5/6 is discussed below in detail. In addition, the discussion includes how to create proxy and console applications.
Step-1: Once a service is hosted in IIS, we have to consume it in client applications. Before creating the client application, we need to create a proxy for the service.
This proxy is used by the client application to interact with the service. To create a proxy, run Visual Studio 2008 command prompt.
Using service utility, we can create the proxy class and its configuration information.
svcutilhttp://localhost/IISHostedService/Service.svc
After executing this command, we will get two files generated in the default location.
MyService.cs – Proxy class for the WCF service
output.config – Configuration information about the service
Step-2: Now, we will start creating the Console application using Visual Studio 2008 (Client application).
Step-3: Add the reference 'System.ServiceModel'; this is the core dll for WCF.
Step-4: Create a Proxy class.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text; namespace MyServiceClient
{
Class Program
{
Static void Main(string[] args)
{
// Creating Proxy for the MyService
ServiceClient Client = newServiceClient();
Console.WriteLine("Client calling the service...");
Console.WriteLine("Hello Ram");
Console.Read();
}
}
}
The output appears as follows:
WCF - Consuming WCF Service的更多相关文章
- wcf和web service的区别
1.WebService:严格来说是行业标准,不是技术,使用XML扩展标记语言来表示数据(这个是夸语言和平台的关键).微软的Web服务实现称为ASP.NET Web Service.它使用Soap简单 ...
- WCF和Web Service的 区(guan)别(xi)
参考文献:http://social.microsoft.com/Forums/zh-CN/c06420d1-69ba-4aa6-abe5-242e3213b68f/wcf-webservice 之前 ...
- WCF与 Web Service的区别是什么?各自的优点在哪里呢?
这是很多.NET开发人员容易搞错的问题.面试的时候也经常遇到,初学者也很难分快速弄明白 Web service: .net技术中其实就指ASP.NET Web Service,用的时间比较长,微软其实 ...
- 跟我一起学WCF(13)——WCF系列总结
引言 WCF是微软为了实现SOA的框架,它是对微乳之前多种分布式技术的继承和扩展,这些技术包括Enterprise Service..NET Remoting.XML Web Service.MSMQ ...
- Learing WCF Chapter1 WCF Services
WCF ServicesWCF services are the new distributed boundary in an enterprise application—with an empha ...
- 使用WCF 创建 Rest service
REST SERVICE 允许客户端修改url路径,并且web端功过url 请求数据. 他使用http协议进行通讯,想必大家都知道 . 并且我们可以通过设置进行数据类型转换, 支持XML,JSON 格 ...
- 在IIS8.5的环境下配置WCF的Restful Service
今天在客户的环境中(Windows Server 2012 R2 + IIS 8.5)搭建Call WCF Restful Service的功能,发现了几个环境配置的问题,记录如下: 1):此环境先安 ...
- 扩展Wcf call security service, 手动添加 Soap Security Head.
有次我们有个项目需要Call 一个 Java 的 web service, Soap包中需要一个 Security Head <soapenv:Header> <wsse:Secur ...
- Entity Framework + WCF REST JSON Service
利用EF 和WCF 建立一个REST JSON Service. 首先我们要下载一个Visual Studio 的Template 叫 "ADO.NET C# POCO Entity Gen ...
随机推荐
- WCF编程系列(二)了解WCF
WCF编程系列(二)了解WCF 面向服务 服务是复用进化的结果,起初的复用是函数,面向对象编程的出现使复用从函数上升到对象,随后面向组件编程又将复用从对象上升到组件,现在面向服务编程将复用 ...
- bzoj1002:[FJOI2007]轮状病毒
思路:一道很裸的生成树计数问题,然而要高精度,而且听说直接行列式求值会被卡精度,所以可以模拟行列式求值的过程得到递推公式:f[i]=3*f[i-1]-f[i-2]+2,证明详见vfk博客: http: ...
- mysql与Navicat for MySQL的衔接配置问题【原创】
首先改一下php的配置文件: 这里主要该两个地方:Cirl + F 查找到mysql.dll 然后去掉前面的";" 然后是修改路径:Cirl + F 查找到extension_di ...
- https证书申请
因为要为海外组的aws设置https证书,由于使用的是新的域名,所以要先申请购买证书,然后设置上去.由于是第一次做这件事.所以过程有些坎坷. 先购买https证书.看了几家,感觉GoDad ...
- PHP输出
样例: $a = true;$b = false;$c = 086;$d = 0x86;echo "$a hase value: ".$a; echo "<br/& ...
- thinkphp分页实现
以上为我对于thinkphp分页的实现效果,两种方法,一种调用公共函数中的函数方法(参考http://www.cnblogs.com/tianguook/p/4326613.html),一种是在模型中 ...
- ie6下 gif动画不动
ie6下 gif动画不动 如果有onclick事件:在IE6中,点击a标签,onclick事件会先执行,其次是href下的动作,href执行后,默认会执行跳转动作(尽管href属性不一定是一个地址), ...
- 【python】Windows安装Beautiful Soup
环境:win10,python 3.5,Beautiful Soup 4.1 步骤1:设定python为系统环境变量,具体设置如下图,在文本后加上";C:\Python35;C:\Pyt ...
- python函数的返回值 讲解
我们一起来聊聊python函数返回值的特殊情况,之前我也碰到过类似方面的问题,到后来查阅了一些资料后,发现原来是这样. 首先,写函数的时候,一定要写函数的文档,这样方便我们识别函数是做什么的.我记得很 ...
- 什么是UI控件
凡是带有Widget参数的组件都是控件.