https://github.com/anicetkeric/wcfservice
REST API Using WCF Service
https://github.com/anicetkeric/wcfservice
rest-api wcf-service
Last synced: 7 months ago
JSON representation
REST API Using WCF Service
- Host: GitHub
- URL: https://github.com/anicetkeric/wcfservice
- Owner: anicetkeric
- Created: 2017-05-09T17:54:19.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-05-18T22:40:55.000Z (about 9 years ago)
- Last Synced: 2024-12-29T08:11:46.102Z (over 1 year ago)
- Topics: rest-api, wcf-service
- Language: C#
- Size: 37.1 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# WcfService
Création d’un service RESTful aven utilisant WCF
Windows Communication Foundation (WCF) est un SDK pour le développement et le déploiement de services sur Windows. WCF fournit un environnement d'exécution pour vos services, vous permettant d'exposer les types CLR en tant que services et de consommer d'autres services en tant que types CLR.
## Prérequis
* Microsoft Visual Studio 2013 ou supérieur
* Postman pour tester notre API: https://www.getpostman.com/apps
## Création du projet WCF
1. Démarrer Visual Studio.
2. Fichier > Nouveau > Projet
3. Visual C# et sélectionnez WCF, puis **Application de service WCF**
## Configuration du fichier web.config
Ajouter le code ci-dessous dans la section
```xml
```
WebHttpBinding est la liaison spécifiquement proposée pour les services RESTful dans Windows Communication Foundation version 3.5.
EndpointBehavior est "webHttp" pour le service RESTful.
## Test avec postman
Demarrer l'application puis tester vos methodes.
| Action | HTTP method |URI|
| ------------- |:-------------:| -----|
| Ajouter un livre | POST |api/book/AddBook/{book} |
| Liste des livres | GET |api/book/GetAllBooks/ |
| Selectionner un livre | GET |api/book/GetBook/{id} |
| Supprimer un livre |DELETE |api/book/DeleteBook/{idBook} |
| Modifier un livre | PUT |api/book/UpdateBook/{book}|