WCF supports a various way to host a service. In this blog, I will explain about Hosting a WCF Service in IIS.
How to host WCF service in IIS?
Step 1: Create a WCF Library project in Visual Studio.
Step 2: Delete Class and Interface which is created by default.
Step 3: Create an interface IProduct. Add one operation contract in this.
Step 4: Add a class Product.cs to implement this interface.
Step 5: Right click on Solution in Visual Studio. Add a new website in the same solution. Select WCF Service.
Step 6: Delete files from App_Code. Add the reference of the WCF service project.
Step 7: Open .SVC file and remove code behind. .SVC file should look like this.
Step 15: Once Service Reference added. You write code to consume WCF service that you created.
WCFServiceReference is the name which I gave while adding WCF service reference.
Step 16: Your output will.
1001 is the Product Id which was passed from the client.
Related blogs to WCF Service-
- Introduction to WCF
- ABC of WCF
- Basics of WCF Architecture
- WCF vs Web Service
- What is XML serialization?
- WCF Binding
- Create first WCF application
- Fault Contract in
- WCF Data Contract vs Message Contract
- Message Contract
- Data Contract Serialization and De-Serialization
- Data Contract in WCF
- Operation Contract in WCF
- Service Contract in WCF
- How to host a WCF service in IIS?
- WAS Hosting in WCF
- Self Hosting in WCF
- How to create WCF RESTful Service.