当前位置:网站首页>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 .
边栏推荐
- Rgb-t tracking - [dataset benchmark] gtot / rgbt210 / rgbt234 / vot-2019-2020 / laser / VTUAV
- HCIP --- MPLS技术
- Data platform scheduling upgrade and transformation | operation practice from Azkaban smooth transition to Apache dolphin scheduler
- Relevant configurations of pychart: change font style and size, change picture background, and change the font color of console output
- Talent column | can't use Apache dolphin scheduler? The most complete introductory tutorial written by the boss in one month [3]
- Yolov6 target detection practice: training your own data set (video tutorial)
- 6. Combined data type
- Apache DolphinScheduler 2.X保姆级源码解析,中国移动工程师揭秘服务调度启动全流程
- Performance test -- lockust performs seckill business scenario test
- NFT数字藏品系统开发:NFT数藏 的最佳数字营销策略有哪些
猜你喜欢
![[200 opencv routines] 231. Gray level co-occurrence matrix (GLCM) for feature description](/img/34/082364611754b5d2ede5ac2f3a42cc.png)
[200 opencv routines] 231. Gray level co-occurrence matrix (GLCM) for feature description

6. Backup and recovery of MySQL database

Opencv learning color detection

Differences in the use of function call pointer parameters *p, * & P

NFT digital collection system development: activating digital cultural heritage

Anaconda installation tutorial - hands on installation

pycharm常用快捷键

Embedded development: tools -- intelligent watchdog design

Compose text and icon splicing to realize drawableleft or drawableright

又是一年开源之夏,1.2万项目奖金等你来拿!
随机推荐
hot100 哈希
PXE高效批量网络装机
To do list application vikunja
Deep learning learning notes -- solve the problem of slow download of CONDA and pip
C51 and MDK coexist keil5 installation tutorial
NFT数字藏品开发:数字藏品与NFT的六大区别
Countdown 2 days! Based on the cross development practice of Apache dolphin scheduler & tidb, you can greatly improve your efficiency from writing to scheduling
成为 Apache 贡献者,So easy!
With Huawei cloud welink, you can connect to the world even in the countryside
6、MySQL数据库的备份与恢复
OAuth2.0系列博客教程汇总
Image annotation software reference
Summer Challenge harmonyos - hamster game based on arkui (JS)
Download and install the free version of typora
Apache Dolphinscheduler3.0.0-beta-1 版本发布,新增FlinkSQL、Zeppelin任务类型
Advanced Mathematics (Seventh Edition) Tongji University exercises 2-5 personal solutions
NFT digital collection system development: digital collections give new vitality to brands
NFT digital collection system development: the collision of literature + Digital Collections
Overview of new features of es11, ES12 and es13
QT: modal, modeless, text box, button, single line input box