How to: Create a Windows Communication Foundation Client
How to: Create a Windows Communication Foundation Client
To create a Windows Communication Foundation client
Create a new console application project by right-clicking on the Getting Started solution, selecting, Add, New Project. In the Add New Project dialog on the left hand side of the dialog select Windows under C# or VB. In the center section of the dialog select Console Application. Name the project GettingStartedClient.
Set the target framework of the GettingStartedClient project to .NET Framework 4.5 by right clicking on GettingStartedClient in the Solution Explorer and selecting Properties. In the dropdown box labeled Target Framework select .NET Framework 4.5. Setting the target framework for a VB project is a little different, in the GettingStartedClient project properties dialog, click the Compile tab on the left-hand side of the screen, and then click the Advanced Compile Options button at the lower left-hand corner of the dialog. Then select .NET Framework 4.5 in the dropdown box labeled Target Framework.
Setting the target framework will cause Visual Studio 2011 to reload the solution, press OK when prompted.
Add a reference to System.ServiceModel to the GettingStartedClient project by right-clicking the Reference folder under the GettingStartedClient project in Solution Explorer and select Add Reference. In the Add Referencedialog select Framework on the left-hand side of the dialog. In the Search Assemblies textbox, type in System.ServiceModel. In the center section of the dialog select System.ServiceModel, click the Add button, and click the Close button. Save the solution by clicking the Save All button below the main menu.
Next you wlll add a service reference to the Calculator Service. Before you can do that, you must start up the GettingStartedHost console application. Once the host is running you can right click the References folder under the GettingStartedClient project in the Solution Explorer and select Add Service Reference and type in the following URL in the address box of the Add Service Reference dialog: http://localhost:8000/ServiceModelSamples/Service and click the Go button. The CalculatorService should then be displayed in the Services list box, Double click CalculatorService and it will expand and show the service contracts implemented by the service. Leave the default namespace as is and click the OK button.
When you add a reference to a service using Visual Studio a new item will appear in the Solution Explorer under the Service References folder under the GettingStartedClient project. If you use the ServiceModel Metadata Utility Tool (Svcutil.exe) tool a source code file and app.config file will be generated.
You can also use the command-line tool ServiceModel Metadata Utility Tool (Svcutil.exe) with the appropriate switches to create the client code. The following example generates a code file and a configuration file for the service. The first example shows how to generate the proxy in VB and the second shows how to generated the proxy in C#:
You have now created the proxy that the client application will use to call the calculator service. Proceed to the next topic in the series: How to: Configure a Basic Windows Communication Foundation Client
How to: Configure a Basic Windows Communication Foundation Client
How to: Use a Windows Communication Foundation Client
How to: Create a Windows Communication Foundation Client的更多相关文章
- How to: Host and Run a Basic Windows Communication Foundation Service
This is the third of six tasks required to create a Windows Communication Foundation (WCF) applicati ...
- Step3 - How to: Host and Run a Basic Windows Communication Foundation Service
This is the third of six tasks required to create a Windows Communication Foundation (WCF) applicati ...
- How to: Implement a Windows Communication Foundation Service Contract
This is the second of six tasks required to create a basic Windows Communication Foundation (WCF) se ...
- Step2 - How to: Implement a Windows Communication Foundation Service Contract
This is the second of six tasks required to create a basic Windows Communication Foundation (WCF) se ...
- How to: Define a Windows Communication Foundation Service Contract
This is the first of six tasks required to create a basic Windows Communication Foundation (WCF) app ...
- Step1 - How to: Define a Windows Communication Foundation Service Contract
https://msdn.microsoft.com/en-us/library/ms731835.aspx This is the first of six tasks required to cr ...
- Windows Communication Foundation (WCF)和Windows CardSpace的示例程序
微软公司昨天发布了一个Windows Communication Foundation (WCF)和Windows CardSpace的示例程序包,内容极为丰富,从最简单的Hello World到复杂 ...
- 【翻译习作】 Windows Workflow Foundation程序开发-第一章02
1.2 Windows Workflow概览 微软的Windows Workflow Foundation(简称WF)是.NET框架3.0版的一部分..NET3.0其它主要部分是Window ...
- Workflow-Microsoft:Windows Workflow Foundation
ylbtech-Workflow-Microsoft:Windows Workflow Foundation 1. Windows Workflow Foundation返回顶部 1.1. Windo ...
随机推荐
- Selfishness is not living as one wishes to live. it is asking others to live as wishes to live.
regin: n. 统治; 任期 lap:n. 大腿部. procession: n. 行列,游行 lessen: n. 减少 wade: v. 跋涉 patriotic: adj. 爱国的 Medi ...
- ELK 学习
[Udemy] ES 7 and Elastic Stack - part 1 [Udemy] ES 7 and Elastic Stack - part 2 [Udemy] ES 7 and Ela ...
- 应用安全-安全设备-Waf系列-软Waf-安全狗(Safedog)
安装 - Linux 下载 http://download.safedog.cn/safedog_linux64.tar.gz wget http://download.safedog.cn/safe ...
- Mac019--Ubuntu上安装Rancher
首先安装:VisualBox虚拟机. 下载:ubuntu镜像 (ubuntu基于linux的免费开源桌面PC操作系统) ======================================== ...
- python列表-增强的赋值操作
增强赋值公式 (1) (2) (3) (4)
- Hibernate入门4
HIbernate的导航查询: 适用场景:当一张A表关联到另一张B表的多条记录,存在一对多的关系(或者多对多),那么查询A表的记录时,就可以将A表某条记录关联的B表的所有记录查询出来,这种方式,就叫做 ...
- nginx 配置总结
可以选择在http{ }中设置:client_max_body_size 20m; 也可以选择在server{ }中设置:client_max_body_size 20m; 还可以选择在locatio ...
- jupyter notebook使用时路径问题和kernel error,安装opencv
修改路径: 在C:\Users\Administrator\ .jupyter 目录下面只有一个“migrated”文件. 打开命令窗口(运行->cmd),进入python的Script目录下输 ...
- 问题 E: Jack的A+B
问题 E: Jack的A+B 时间限制: 1 Sec 内存限制: 128 MB提交: 1996 解决: 601[提交] [状态] [命题人:jsu_admin] 题目描述 现在有整数a,b,请按西 ...
- vue.js(16)--vue的组件
注册一个全局组件 <div id="app"> <test></test> </div> <script> // 注册全 ...