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 highlights off Sign in home articles quick answers discussions features community help creation of simple wcf service c# Articles» Platforms, Frameworks & Libraries» Windows Communication Foundation» General Article Browse Code Stats Revisions (6) Alternatives Comments & Discussions (6) 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... 4.50 (2 votes) We will start with VS 2008. Create a File -> New Project -> WCF ->WCFClassLibrary project as shown below About Article A Technical Blog, originally posted at Creating a WCF service in C#. Type Licence Technical Blog CPOL First Posted 11 Jun 2012 Views 5,338 Bookmarked WCF 7 times Hot News: Seven Habits of Highly Effective Programmers The Code Project Insider. Free each morning. Related Articles Select WCF in left panel and WCF Service Library in the right panel. Give appropriate name in the Name Box. Click Ok. The Project will contain a sample Service1.cs & IService.cs files. Delete it. So that we can add our own service and understand the things in better way. Right click on MathsLibrary -> Add -> New Item -> Select Class1.cs. Rename it to MathsOperations.cs 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 Towards the selfdocumenting database: extended properties Accessibility audit vs. accessibility testing 1/6
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. 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 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. Now let s modify App.config. Right click on App.config, click on Edit WCF Configuration 2/6
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. Similarly go to Endpoints, and select proper contract with same steps as above. 3/6
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. Add service reference to the MathsService that we have created. It will automatically load all necessary dlls. 4/6
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 Member Article Top Sign Up to vote Poor Excellent Vote Comments and Discussions You must Sign In to use this message board. Search this forum Go Profile popups Noise Medium Layout Expand Posts & Replies Per page 25 Update there exists a well written documentation VallarasuS 20:49 12 Jun '12 Readers may find this useful. Getting Started Tutorial[^]... Regards Vallarasu S FSharpMe.blogspot.com 5/6
Blog Link 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. Plagiarism is never a good idea... [WITHDRAWN] [modified] 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. Re: Plagiarism is never a good idea... 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. Re: Plagiarism is never a good idea... 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 Image formatting at the end. 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 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 Permalink Advertise Privacy Mobile Web01 2.6.120919.1 Last Updated 12 Jun 2012 Layout: fixed fluid Article Copyright 2012 by TheDhruv Everything else Copyright CodeProject, 1999-2012 Terms of Use 6/6