SlideShare a Scribd company logo
Windows Communication Foundation (WCF) using Visual Studio
2013
Now, let us see how to create simple WCF to do simple mathematical calculations.
I am using Visual Studio 2013 to create this project.
1. Invoke Visual Studio
2. Select New Project
3. Under Installed templates, choose Web → WCF → WCF Service Application
4. Give a name to this project. I have named this project as mathematics
5. Press OK button
6. Now, from Solution Explorer window, delete IService1.cs and Service1.cs files. See
the below picture.
7. Now, Right click on your project – Mathematics
8. Select Add → New Item →WCF Service
9. Give some name to this service. I have names it as maths. Notice that Imaths.cs and
maths.cs files created automatically and you can see them from the Solution
Explorer window.
10. Now open Imaths.cs file by double clicking on it
11. Look for void DoWork() method. Remove this method and add two methods add
and sub to return addition and subtraction of two numbers as shown (see the next
page)
Delete
these files
12. Now, open maths.cs file double clicking on that file
13. Remove method public void DoWork() method. In its place add the code as shown
below:
14. Like asmx web services, here too you can build this code and test by selecting Build
→ Build Solution option. Try it yourself an check whether system displays any error
messages or not.
15. You can also run these programs by clicking on Start button. Try it yourself.
Consuming WCF methods from
Now, let us see how to consume the above created methods from a web page.
1. Click on Project – Mathematics.
2. Select Add → New Item → Web Form. Give some name to this webform. I named it
as calculate
3. Change to Design mode
4. Add a Button to this form.
5. Double Click on the button
6. In the Button_click event, add the following codes.
7. Now, run the web page to display the sum and difference of 200 and 100.
Try it yourself:
- Instead of passing hard coded values 200 and 100, please add two textboxes in the
webform so that users can enter two numerical values at runtime.
- BK Dharmaraju, Bangalore, India – has around 30 years of
experience in the field of IT.

More Related Content

PDF
How to create C# Windows Service Application
PDF
Windows Phone Workshop: WCF services
PPTX
Database presentation
PPTX
Visual studio tips and tricks
PPT
Evaluation Instructions Ppt
PDF
Programming Without Coding Technology (PWCT) - HarbourPWCT - Hello World - Co...
PPTX
exe in MatLab
PPTX
Visual basics Express Project
How to create C# Windows Service Application
Windows Phone Workshop: WCF services
Database presentation
Visual studio tips and tricks
Evaluation Instructions Ppt
Programming Without Coding Technology (PWCT) - HarbourPWCT - Hello World - Co...
exe in MatLab
Visual basics Express Project

What's hot (8)

DOCX
Providing sl no in Gridview in Dot Net
PPTX
Add contacts
PDF
Admin Habits & Hacks Handout - Salesforce World Tour Boston
PDF
Visual studio 2012
TXT
PPT
Maintenance Reporting Website
PPTX
Microsoft office access 2003
PDF
Entity frame work by Salman Mushtaq -1-
Providing sl no in Gridview in Dot Net
Add contacts
Admin Habits & Hacks Handout - Salesforce World Tour Boston
Visual studio 2012
Maintenance Reporting Website
Microsoft office access 2003
Entity frame work by Salman Mushtaq -1-
Ad

Similar to Windows Communication Foundation (WCF) programming using Visual Studio (20)

PDF
Web services in asp.net
DOC
WCF tutorial
PPTX
Web services
PDF
Dot net training bangalore
PDF
WCF Multi Layer Services Development with Entity Framework 4th Edition Editio...
PPT
Web services intro.
PDF
Microsoft .net 2015 Training in Noida Delhi ncr
PPTX
PDF
.NET WPF Services
PPT
Building+restful+webservice
PPTX
10 Tricks and Tips for WCF
PDF
6 Months Dotnet internship in Noida
PPTX
PDF
Secure .NET programming
PDF
Creating and Consuming Web Services in Visual Basic First Edition Seely S.
PPT
Session 1 Shanon Richards-Exposing Data Using WCF
PPTX
1. WCF Services - Exam 70-487
PDF
CASE-4 Automating Business Processes in Denver: A Technical Case Study
PPTX
WCF (Windows Communication Foundation)
PPTX
Xml web services
Web services in asp.net
WCF tutorial
Web services
Dot net training bangalore
WCF Multi Layer Services Development with Entity Framework 4th Edition Editio...
Web services intro.
Microsoft .net 2015 Training in Noida Delhi ncr
.NET WPF Services
Building+restful+webservice
10 Tricks and Tips for WCF
6 Months Dotnet internship in Noida
Secure .NET programming
Creating and Consuming Web Services in Visual Basic First Edition Seely S.
Session 1 Shanon Richards-Exposing Data Using WCF
1. WCF Services - Exam 70-487
CASE-4 Automating Business Processes in Denver: A Technical Case Study
WCF (Windows Communication Foundation)
Xml web services
Ad

More from Dharma Raju (8)

DOCX
Master slave control in gridview
DOCX
Change row colour based on some condition
DOCX
Popup confirmation for Delete Button in GridView
DOCX
How to add sorting and pagers to grid view
DOCX
How to add sql server table into dot net web page (Gridview)
PDF
Internal tables in sap
PDF
Govina haadu
PPS
Coffee
Master slave control in gridview
Change row colour based on some condition
Popup confirmation for Delete Button in GridView
How to add sorting and pagers to grid view
How to add sql server table into dot net web page (Gridview)
Internal tables in sap
Govina haadu
Coffee

Recently uploaded (20)

PPTX
Introduction to Artificial Intelligence
PPTX
ManageIQ - Sprint 268 Review - Slide Deck
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
AI in Product Development-omnex systems
PDF
Digital Strategies for Manufacturing Companies
PPT
Introduction Database Management System for Course Database
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
Become an Agentblazer Champion Challenge Kickoff
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Multi-factor Authentication (MFA) requirement for Microsoft 365 Admin Center_...
PDF
Best Practices for Rolling Out Competency Management Software.pdf
PPTX
Materi_Pemrograman_Komputer-Looping.pptx
PPTX
L1 - Introduction to python Backend.pptx
PPTX
Transform Your Business with a Software ERP System
PDF
top salesforce developer skills in 2025.pdf
PDF
Understanding Forklifts - TECH EHS Solution
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
System and Network Administraation Chapter 3
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
How Creative Agencies Leverage Project Management Software.pdf
Introduction to Artificial Intelligence
ManageIQ - Sprint 268 Review - Slide Deck
How to Migrate SBCGlobal Email to Yahoo Easily
AI in Product Development-omnex systems
Digital Strategies for Manufacturing Companies
Introduction Database Management System for Course Database
Which alternative to Crystal Reports is best for small or large businesses.pdf
Become an Agentblazer Champion Challenge Kickoff
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Multi-factor Authentication (MFA) requirement for Microsoft 365 Admin Center_...
Best Practices for Rolling Out Competency Management Software.pdf
Materi_Pemrograman_Komputer-Looping.pptx
L1 - Introduction to python Backend.pptx
Transform Your Business with a Software ERP System
top salesforce developer skills in 2025.pdf
Understanding Forklifts - TECH EHS Solution
Softaken Excel to vCard Converter Software.pdf
System and Network Administraation Chapter 3
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
How Creative Agencies Leverage Project Management Software.pdf

Windows Communication Foundation (WCF) programming using Visual Studio

  • 1. Windows Communication Foundation (WCF) using Visual Studio 2013 Now, let us see how to create simple WCF to do simple mathematical calculations. I am using Visual Studio 2013 to create this project. 1. Invoke Visual Studio 2. Select New Project 3. Under Installed templates, choose Web → WCF → WCF Service Application 4. Give a name to this project. I have named this project as mathematics 5. Press OK button 6. Now, from Solution Explorer window, delete IService1.cs and Service1.cs files. See the below picture. 7. Now, Right click on your project – Mathematics 8. Select Add → New Item →WCF Service 9. Give some name to this service. I have names it as maths. Notice that Imaths.cs and maths.cs files created automatically and you can see them from the Solution Explorer window. 10. Now open Imaths.cs file by double clicking on it 11. Look for void DoWork() method. Remove this method and add two methods add and sub to return addition and subtraction of two numbers as shown (see the next page) Delete these files
  • 2. 12. Now, open maths.cs file double clicking on that file 13. Remove method public void DoWork() method. In its place add the code as shown below:
  • 3. 14. Like asmx web services, here too you can build this code and test by selecting Build → Build Solution option. Try it yourself an check whether system displays any error messages or not. 15. You can also run these programs by clicking on Start button. Try it yourself. Consuming WCF methods from Now, let us see how to consume the above created methods from a web page. 1. Click on Project – Mathematics. 2. Select Add → New Item → Web Form. Give some name to this webform. I named it as calculate 3. Change to Design mode 4. Add a Button to this form. 5. Double Click on the button 6. In the Button_click event, add the following codes. 7. Now, run the web page to display the sum and difference of 200 and 100. Try it yourself: - Instead of passing hard coded values 200 and 100, please add two textboxes in the webform so that users can enter two numerical values at runtime. - BK Dharmaraju, Bangalore, India – has around 30 years of experience in the field of IT.