×
highlights off Not quite what you are looking for? You may want to try:Three ways to do WCF instance management A closer look at Windows Communication Foundation
Sign in
home quick answers discussions features community help
Articles » Platforms, Frameworks & Libraries » Windows Communication Foundation » General
creation of simple wcf service c#
Article Browse Code Stats Revisions (6) Alternatives Comments & Discussions (6)
About Article
A Technical Blog, originally posted at Creating a WCF service in C#.
Type Technical
Blog
Licence CPOL
First Posted 11 Jun 2012
Views 5,338
Bookmarked 7 times WCF
Hot News: Seven Habits of Highly Effective Programmers The Code Project Insider. Free each morning.
Related Articles
Iterating through menustrip items
LINQ on the command-line Merge DataGrid Header How To Lock Device Screen For Windows Mobile Creating animations with Dundas Chart for ASP.NET Smarter Data Labels with Dundas Chart SmartLabels Understanding Chart Areas with Dundas Chart for .NET Using screensavers inside the Windows Media Player Making Sense of Geographic Data with Dundas Map and AJAX
Handling connection notification between a desktop machine and Windows CE based devices SmartLink
Create data-driven applications with the Hera Application Framework
WCF Service Creation With C#
By TheDhruv, 12 Jun 2012
Basic WCF Service Creation in C#.Net => Part1
Hello all, this is the start up guide to create WCF service. This article is a pictorial step by step help to create WCF application.
WCF (Windows Communication Foundation) is a part of .NET 3.0. So you need to install Visual Studio 2008 to use WCF.
It is platform for SOA. WCF provides a way to create loosely coupled application. WCF is intended to provide services that are distributed and interoperable.
It unifies ASMX and .NET Remoting, MSMQ and can be easily extended to support new protocol.
When we create a Service, to expose the functionality to the world, it needs to be hosted into Host Process. Service Host will be used to expose the end point of the service to other Service or Clients.
Let’s start with the steps...
We will start with VS 2008. Create a File -> New Project -> WCF ->WCFClassLibrary project as shown below
Select WCF in left panel and WCF Service Library in the right panel. Give appropriate name in the Name Box. Click Ok.
4.50 (2 votes) articles
Digital Signatures and PDF Documents
People Search using search.asmx WMP Power Hour APP How to Retrieve EMC Centera Cluster/Pool Capabilities Using Barcodes in Documents – Best Practices
"Hey! Is That My Car? How to Sharpen a QuickBird Satellite Image Using DotImage" Integrate your SharePoint environment into the open standards-based WebSphere Portal platform using the Visual Studio IDE This will create a simple class file. Open the file. Make the class public.
Similary add one more class IMathsOperations.cs, which will be an interface, which will provide a list of what all operations a WCF service will perform.
Open IMathsOperations.cs and change it to public interface IMathsOperations And add the below code to it..
To make IMathsOperations as WCF Service Contract, add an attribute [ServiceContract]to it.
Also what all operation you want to make visible to client should be decorated with [OperationContract]. [ServiceContract] and [OperationContract]are included in System.ServiceModel namespace.
Now once decided with the contract, we can implement this interface into our srevice as below
Build the project once you are done up to this. Let us add app.config to Host solution.
App.config contains endpoint details, which includes ABC (Address, Binding and Contract) Address is the Address WHERE the service can be found.
Binding the HOW to access the service Contract is WHAT the service contains.
Below popup should appear
Select the Service1 from left panel, following window should show up
Click on ellipses button and go the path where the MathsLibrary.dll exists. Click on it, it will give you the name of the service it contains.
Also we can change the binding to be used as below…
Select Host on left hand side and it will show you base address, edit the base address to whatever you want..
Once this is done. Build the project.
VS 2008 provides you the way to host the service. We can also host it in console application or Windows Service or IIS.
We will learn those in next parts. Here we will use the host provided by VS 2008.
Now let’s create a client application. Add console application (Or any other project type) project in same solution or different solution.
Article Top Sign Up to vote Poor Excellent Vote
Search this forum Go
Then with the below code we can give a call to the service..
This will give you below output
In the next sub-sections we will see how to host this service in IIS, Windows services, Console applications etc.
License
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)
About the Author
TheDhruv
United States MemberComments and Discussions
You must Sign In to use this message board.
Profile popups Noise Medium Layout Expand Posts & Replies Per page 25 Update
VallarasuS 20:49 12 Jun '12
there exists a well written
Permalink | Advertise | Privacy | Mobile
Web01 | 2.6.120919.1 | Last Updated 12 Jun 2012 Everything else Copyright © Article Copyright 2012 by TheDhruvCodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid
Sign In · View Thread · Permalink
Tim Corey 4:39 11 Jun '12
Could you please change your blog link to point to the actual blog post instead of to the generic feed? That will help readers go right where they want to go directly and it will be less confusing.
Sign In · View Thread · Permalink
OriginalGriff 3:38 11 Jun '12
http://firstlineofcode.blogspot.co.uk/2012/05/basic-wcf-service-creation-in-c.html[^]
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
modified 10:52 11 Jun '12.
Sign In · View Thread · Permalink
Tim Corey 4:38 11 Jun '12
I'm fairly certain that this blog post came from that blog. The OP linked to the blog feed instead of the specific article, but it is from the same site. The OP has done this in the past to the same location.
Sign In · View Thread · Permalink
OriginalGriff 4:52 11 Jun '12
In which case I withdraw my comment unreservedly!
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
Sign In · View Thread · Permalink
Ammar_Ahmad 2:53 11 Jun '12
Image alignment (the last 2 images) are kinda messed up. *Edit
Seems that the issue has been fixed. btw nice article
Sign In · View Thread · Permalink 2.00/5 (1 vote)
Last Visit: 21:43 19 Sep '12 Last Update: 3:43 20 Sep '12 Refresh 1
General News Suggestion Question Bug Answer Joke Rant Admin
Blog Link
Plagiarism is never a good idea...
[WITHDRAWN] [modified]
Re: Plagiarism is never a good idea...
Re: Plagiarism is never a good idea...