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 ...
随机推荐
- C#中var类型
var关键字是C#3.0新增的特性,当你不能确定自己需要使用的类型时,可以选择使用var var可以代替任何类型,var关键字指示编译器根据初始化语句右侧表达式推断变量类型 例: int a = 2 ...
- EasyUI的DataGrid 分页栏英文改中文解决方案
(一)分页栏英文改中文解决方案 这个问题其实很简单,就是引入文件jquery-easyui-1.3/locale/easyui-lang-zh_CN.js . 注意这个文件要放在本页js的后面,放在最 ...
- Wix: Using Patch Creation Properties - Minor Update
Based on the project created in Wix: Using Patch Creation Properties - Small Update, Following chang ...
- strcpy(),string使用问题
两个CString,把一个赋值给另外一个,用strncpy出现问题,直接=赋值正确了,不知道为什么?
- SSD论文优秀句子
1. Nonvolatile memory(e.g., Phase Change Memory) blurs the boundary between memory and storage and i ...
- RX学习笔记:JavaScript数组操作
RX学习笔记:JavaScript数组操作 2016-07-03 增删元素 unshift() 在数组开关添加元素 array.unshift("value"); array.un ...
- winfrom 多语言切换
1.首先将窗体的“Localizable”属性置为“True”,然后将“Language”属性置为自己想要的语言,点击重新生成项目 例如:置为“中文”,以及“英文”.当每次置为不同的语言并重新生成项目 ...
- django分页工具
from django.core.paginator import Paginator 此对象可以进行分页操作 objects = Entry.objects.all() page = Paginat ...
- MySQL基础学习之索引
创建新表新索引 CREATE TABLE 表名(数据名 类型,INDEX 索引名称(属性)) 创建存在表的索引 CREATE INDEX 索引名称 ON 表名(属性) 修改索引 ALTER TAB ...
- [python]使用ElementTree解析XML【译】
19.7 The ElementTree XML API 源码:Lib/xml/etree/ElementTree.py Element类型是一个灵活的容器对象,设计出来是用于存储有层次的数据结构到内 ...