当前位置:网站首页>WCF introductory tutorial II
WCF introductory tutorial II
2022-07-26 07:22:00 【51CTO】
author :jiankunking
Basic knowledge :
[ServiceContract] Attribute You can have the following Property Of :
CallbackContract Set up callback The type of :Duplicate finger Service Host and Client Two way communication between
ConfigurationName Specify a... In the configuration file configuration Name
HasProtectionLevel Indicate whether security messages can be processed
Name to contract Specify a name , stay client A visible name , The default is the interface name
Namespace Assign a namespace to the message
ProtectionLevel
SessionMode Permissive , Still not allowed , Or mandatory session
[OperationContract] Attribute You can have the following Property Of :
Action Set... On request WS-Addressing Of action
AsynchPattern Asynchronous mode
HasProtectionLevel Whether the message is encrypted , Signature
IsInitiating Indicates whether the function should be called in server Initialize one above session
IsOneWay Indicates that the function is client After calling ,client Whether it will wait for the function to return
IsTerminating Indicates whether the function should be called at the end of server It's off session
Name Set the name of the function , stay client A visible name , The default is the function name
ProtectionLevel
ReplyAction Set the function to return the message SOAP action
1、 You can see all kinds of information on the Internet ServiceContract Of Namespace、Name And other attribute assignment codes , But these Attribute Where does it work ?

Let's take a look at , Open the solution in the previous article WcfFirstDemo.sln
Right click WCFServiceDemo The file below the project :Test..svc, Here's the picture :

The effect is as follows :

Click on the link in the red box , The effect is as follows :

You can see the default Namespace yes http://tempuri.org/,name Consistent with the class name
Microsoft official advice : modify Service Of Namespace, To include : Company domain name + Project name + Version number ( Such as : Date indicates version number )
Note :

Modification item :WCFServiceDemo Below ITest.cs The code is as follows :
Right click on the item WCFServiceDemo Choose recompile , After the successful , Reopen with browser
ITest.svc, The following figure is obtained :

At this time, it has changed Service default Namespace 了 , Regenerate the deployment package , Deploy to server , And then update it client End , Then recompile the entire solution , We will report an error as follows :

here ServiceContract So it has been changed to JianKunKing Not before Test 了 , Here's the picture :

After correcting the error , Take a look at client Terminal app.config file , as follows , You can see bindingConfiguration、contract、name And other properties have been modified

It can be compared with that before modification app.config Compare the documents :

From this we can see that ServiceContract Of Namespace、Name And so on. , Can play the role of renaming , Hide the real information of the server class , What the client sees is what you want it to see
ServiceContract The job is to specify service towards client Which functions are available to call .
边栏推荐
- Data platform scheduling upgrade and transformation | operation practice from Azkaban smooth transition to Apache dolphin scheduler
- [yiku] wonderful! This library organization NPM script is simply explosive!
- July training (day 18) - tree
- 正则表达式如何写变量
- 中国联通改造 Apache DolphinScheduler 资源中心,实现计费环境跨集群调用与数据脚本一站式访问
- Qt:列表框、表格、树形控件
- Yolov5 improvements: add attention mechanism (video tutorial)
- NFT digital collection development: Six differences between digital collections and NFT
- Leetcode:749. isolate virus [Unicom component + priority queue + status representation]
- Download and install the free version of typora
猜你喜欢

Singles cup web WP

金融任务实例实时、离线跑批Apache DolphinScheduler在新网银行的三大场景与五大优化

In July, glassnode data showed that the open position of eth perpetual futures contract on deribit had just reached a one month high of $237959827.

anaconda安装教程-手把手教你安装

排序:归并排序和快速排序

3.0.0 alpha 重磅发布!九大新功能、全新 UI 解锁调度系统新能力

Compose Canvas line chart

OAuth2.0系列博客教程汇总

NFT数字藏品系统开发:华为发布首款珍藏版数字藏品

To do list application vikunja
随机推荐
Image annotation software reference
Taishan office lecture: word error about inconsistent values of page margins
Apache DolphinScheduler 2.X保姆级源码解析,中国移动工程师揭秘服务调度启动全流程
WCF 部署在IIS上
Opencv learning color detection
【一库】妙啊!这个库组织npm脚本简直爆炸!
Modulenotfounderror: no module named 'pip' solution
7月消息,Glassnode数据显示,Deribit上ETH永续期货合约未平仓头寸刚刚达到一个月高点237,959,827美元。
Overview of new features of es11, ES12 and es13
6. Combined data type
漂洋过海来看你
成为 Apache 贡献者,So easy!
屏:框贴、0贴合、全贴合
NFT digital collection system development: Huawei releases the first collector's digital collection
NFT数字藏品系统开发:文学+数字藏品的碰撞
RGB-T追踪——【数据集基准】GTOT / RGBT210 / RGBT234 / VOT-2019-2020 / LasHeR / VTUAV
tensorflow2.x中的量化感知训练以及tflite的x86端测评
Hcip - MPLS Technology
Typora免费版下载安装
404 page best practices to improve user experience