windows comunication foundation
DESCRIPTION
Giới thiệu về WCFTRANSCRIPT
![Page 1: Windows comunication foundation](https://reader034.vdocument.in/reader034/viewer/2022052323/55947a561a28ab28558b4689/html5/thumbnails/1.jpg)
![Page 2: Windows comunication foundation](https://reader034.vdocument.in/reader034/viewer/2022052323/55947a561a28ab28558b4689/html5/thumbnails/2.jpg)
MỤC LỤCĐịnh nghĩa
Mục tiêu
Kiến trúc
Mô hình lập trình
Xây dựng WCF Service
Demo
Chủ đề nâng cao
WCF - GROUP 10 - 1012331 - 1212067 2
1
2
3
4
5
6
7
1
2
3
4
5
6
7
![Page 3: Windows comunication foundation](https://reader034.vdocument.in/reader034/viewer/2022052323/55947a561a28ab28558b4689/html5/thumbnails/3.jpg)
1. ĐỊNH NGHĨA
• Là mô hình lập trình giúp xây dựng ứng dụng hướng dịch vụ (service oriented app)
• Kết hợp tất cả các tính năng của các kỹ thuật xây dựng ứng dụng phân tán
Com + service
.Net remoting
Web services
WCF - GROUP 10 - 1012331 - 1212067 3
![Page 4: Windows comunication foundation](https://reader034.vdocument.in/reader034/viewer/2022052323/55947a561a28ab28558b4689/html5/thumbnails/4.jpg)
2. MỤC TIÊU
• Cho phép 2 ứng dụng trao đổi các thông điệp với nhau
Cùng nền tảng
Khác nền tảng
WCF - GROUP 10 - 1012331 - 1212067 4
![Page 5: Windows comunication foundation](https://reader034.vdocument.in/reader034/viewer/2022052323/55947a561a28ab28558b4689/html5/thumbnails/5.jpg)
3. KIẾN TRÚC
WCF - GROUP 10 - 1012331 - 1212067 5
Contracts
Service runtime
Messaging
Activation and hosting
![Page 6: Windows comunication foundation](https://reader034.vdocument.in/reader034/viewer/2022052323/55947a561a28ab28558b4689/html5/thumbnails/6.jpg)
4. MÔ HÌNH LẬP TRÌNH
• Mọi liên lạc với WCF Service được diễn ra tại các endpoint của service.
• Endpoint gồm:
Address (Where)
Binding (How)
Contract (What)
WCF - GROUP 10 - 1012331 - 1212067 6
![Page 7: Windows comunication foundation](https://reader034.vdocument.in/reader034/viewer/2022052323/55947a561a28ab28558b4689/html5/thumbnails/7.jpg)
4.1. ADDRESS
• Cung cấp thông tin về nơi chứa service.
• Bao gồm các thông tin
Protocol (http, netTcp, …)
Máy chủ
Port
Đường dẫn
• VD: http://localhost:8080/DangKyHocPhan/Service.svc
WCF - GROUP 10 - 1012331 - 1212067 7
![Page 8: Windows comunication foundation](https://reader034.vdocument.in/reader034/viewer/2022052323/55947a561a28ab28558b4689/html5/thumbnails/8.jpg)
4.2. BINDING
• Mô tả cách thức WCF Service giao tiếp với các ứng dụng khác.
• WCF cung cấp các phương án binding sau:
basicHttpBinding
wsHttpBinding
netTcpBinding
netNamedPipBinding
….
WCF - GROUP 10 - 1012331 - 1212067 8
![Page 9: Windows comunication foundation](https://reader034.vdocument.in/reader034/viewer/2022052323/55947a561a28ab28558b4689/html5/thumbnails/9.jpg)
4.3. CONTRACT
• Chỉ ra các interface, class, hàm, kiểu dữ liệu của WCF Service mà client được phép
sử dụng.
• WCF cung cấp các loại contract sau:
Service contract
Operation contract
Data contract
Message contract
Fault contract
WCF - GROUP 10 - 1012331 - 1212067 9
![Page 10: Windows comunication foundation](https://reader034.vdocument.in/reader034/viewer/2022052323/55947a561a28ab28558b4689/html5/thumbnails/10.jpg)
5. XÂY DỰNG WCF SERVICE
1. Xây dựng WCF Service Library (.dll)
i. Xác định ServiceContract, OperationContract, DataContract
ii. Xây dựng các hàm cần thiết ở service
2. Host Service Library
i. Chọn phương án host
ii. Cấu hình các endpoint
iii. Khởi động service
WCF - GROUP 10 - 1012331 - 1212067 10
![Page 11: Windows comunication foundation](https://reader034.vdocument.in/reader034/viewer/2022052323/55947a561a28ab28558b4689/html5/thumbnails/11.jpg)
5.1. CONTRACT
WCF - GROUP 10 - 1012331 - 1212067 11
![Page 12: Windows comunication foundation](https://reader034.vdocument.in/reader034/viewer/2022052323/55947a561a28ab28558b4689/html5/thumbnails/12.jpg)
5.1. CONTRACT (TT)
WCF - GROUP 10 - 1012331 - 1212067 12
![Page 13: Windows comunication foundation](https://reader034.vdocument.in/reader034/viewer/2022052323/55947a561a28ab28558b4689/html5/thumbnails/13.jpg)
5.2. HOST WCF SERVICE
• Self-Hosting (.exe)
• Windows Service
• IIS (.svc)
• Windows Activation Service (WAS)
WCF - GROUP 10 - 1012331 - 1212067 13
![Page 14: Windows comunication foundation](https://reader034.vdocument.in/reader034/viewer/2022052323/55947a561a28ab28558b4689/html5/thumbnails/14.jpg)
5.2. WAS HOST
• Sử dụng file .svc
• IIS7+
• Cho phép giao tiếp thông qua các giao thức non-HTTP (netTcp,…)
WCF - GROUP 10 - 1012331 - 1212067 14
![Page 15: Windows comunication foundation](https://reader034.vdocument.in/reader034/viewer/2022052323/55947a561a28ab28558b4689/html5/thumbnails/15.jpg)
5.2. WAS (TT)
WCF - GROUP 10 - 1012331 - 1212067 15
![Page 16: Windows comunication foundation](https://reader034.vdocument.in/reader034/viewer/2022052323/55947a561a28ab28558b4689/html5/thumbnails/16.jpg)
5.2. WAS (TT)
WCF - GROUP 10 - 1012331 - 1212067 16
![Page 17: Windows comunication foundation](https://reader034.vdocument.in/reader034/viewer/2022052323/55947a561a28ab28558b4689/html5/thumbnails/17.jpg)
5.2. WAS HOST
WCF - GROUP 10 - 1012331 - 1212067 17
DEMO CÁCH TẠO ỨNG DỤNG WCF VÀ HOST LÊN IIS
![Page 18: Windows comunication foundation](https://reader034.vdocument.in/reader034/viewer/2022052323/55947a561a28ab28558b4689/html5/thumbnails/18.jpg)
5.2. WAS HOST (TT)
WCF - GROUP 10 - 1012331 - 1212067 18
XỬ LÝ CHO GIAO DIỆN
![Page 19: Windows comunication foundation](https://reader034.vdocument.in/reader034/viewer/2022052323/55947a561a28ab28558b4689/html5/thumbnails/19.jpg)
6. DEMO ĐĂNG KÝ HỌC PHẦN
WCF - GROUP 10 - 1012331 - 1212067 19
![Page 20: Windows comunication foundation](https://reader034.vdocument.in/reader034/viewer/2022052323/55947a561a28ab28558b4689/html5/thumbnails/20.jpg)
7. ĐỀ NÂNG CAO
WCF - GROUP 10 - 1012331 - 1212067 20
• Transaction: HTTP://WWW.CODEPROJECT.COM/ARTICLES/38793/6-STEPS-TO-ENABLE-
TRANSACTIONS-IN-WCF
![Page 21: Windows comunication foundation](https://reader034.vdocument.in/reader034/viewer/2022052323/55947a561a28ab28558b4689/html5/thumbnails/21.jpg)
THE END!
WCF - GROUP 10 - 1012331 - 1212067 21
• HỎI & ĐÁP.
• SOURCE CODE VÀ SLIDE SẼ ĐƯỢC CUNG CẤP CHO CÁC BẠN THAM KHẢO.
• CẢM ƠN THẦY VÀ CÁC BẠN ĐÃ THEO DÕI.