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 ...
随机推荐
- 第三篇、CSS样式简介
<!--1.行内样式 <p style="background-color:red;font-size:20px"> --> <!--2.页内样式 & ...
- Java多线程的安全问题
/*多线程的安全问题1.为什么会出现安全问题?因为程序在运行时,会出现一个线程在判断条件满足后,具备了执行资格,但没有运行代码后一个线程也判断了条件,也具备了执行资格,后一个线程运行了代码,但这时候, ...
- linux 判断指定用户对指定目录具有的权限
脚本名:power.sh 脚本内容: ------------------------------------------- 注意:必须以root 身份执行该脚本. 脚本power.sh 需要两个参数 ...
- rest和soap_笔记
Web 服务编程,REST 与 SOAP http://www.ibm.com/developerworks/cn/webservices/0907_rest_soap/ Web 服务编程,REST ...
- frameset,frame应用,常用于后台
<!DOCTYPE HTML><html><head><title>lin3615</title></head><fram ...
- NOSQL之【Redis学习:配置说明】
# yes:后台运行:no:不是后台运行(老版本默认) daemonize yes # redis的进程文件 pidfile /var/run/redis.pid # 端口 port # bind_a ...
- [转]MonkeyRunner在Windows下的Eclipse开发环境搭建步骤(兼解决网上Jython配置出错的问题)
MonkeyRunner在Windows下的Eclipse开发环境搭建步骤(兼解决网上Jython配置出错的问题) 网上有一篇shangdong_chu网友写的文章介绍如何在Eclipse上配置M ...
- Custome Buble Data Point
<navigation:Page xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/to ...
- C++编写操作系统(1):基于 EFI 的 Bootloader
很久以前就对操作系统很好奇,用了这么多年Windows,对他的运作机理也不是很清楚,所以一直想自己动手写一个,研究一下操作系统究竟是怎么实现的.后来在网上也找到过一些教程(比如:<自己动手写操作 ...
- 使用js为html元素动态添加class
<ul id="root"> <li>1</li> <li>2</li> <li>3</li> ...