Sie sind auf Seite 1von 28

3/10/2014

K. G. Sreeju Nair - Create and Consume WCF service using Visual Studio 2010

Create and Consume WCF service using


Visual Studio 2010
Wednesday, December 15, 2010
ASP.Net 4 (/sreejukg/Tags/ASP.Net%204)

Visual Studio (/sreejukg/Tags/Visual%20Studio)

WCF (/sreejukg/Tags/WCF)

In this article I am going to demonstrate how to create a WCF service, that can be hosted inside IIS and a
windows application that consume the WCF service.
To support service oriented architecture, Microsoft developed the programming model named Windows
Communication Foundation (WCF). ASMX was the prior version from Microsoft, was completely based on
XML and .Net framework continues to support ASMX web services in future versions also. While ASMX
web services was the first step towards the service oriented architecture, Microsoft has made a big step
forward by introducing WCF.
An overview of planning for WCF can be found from this link http://msdn.microsoft.com/enus/library/ff649584.aspx (http://msdn.microsoft.com/en-us/library/ff649584.aspx) .
The following are the important differences between WCF and ASMX from an asp.net developer point of
view.
1. ASMX web services are easy to write, configure and consume
2. ASMX web services are only hosted in IIS
3. ASMX web services can only use http
4. WCF, can be hosted inside IIS, windows service, console application, WAS(Windows Process Activation
Service) etc
5. WCF can be used with HTTP, TCP/IP, MSMQ and other protocols.
The detailed difference between ASMX web service and WCF can be found here.
http://msdn.microsoft.com/en-us/library/cc304771.aspx (http://msdn.microsoft.com/enus/library/cc304771.aspx)
http://weblogs.asp.net/sreejukg/create-and-consume-wcf-service-using-visual-studio-2010

1/28

3/10/2014

K. G. Sreeju Nair - Create and Consume WCF service using Visual Studio 2010

Though WCF is a bigger step for future, Visual Studio makes it simpler to create, publish and consume
the WCF service. In this demonstration, I am going to create a service named SayHello that accepts 2
parameters such as name and language code. The service will return a hello to user name that
corresponds to the language.
So the proposed service usage is as follows.
Caller: SayHello(Sreeju, en) -> return value -> Hello Sreeju
Caller: SayHello(, ar) -> return value ->
Caller: SayHello(Sreeju, es) - > return value -> Hola Sreeju
Note: calling an automated translation service is not the intention of this article. If you are interested,
you can find bing translator API and can use in your application.
http://www.microsofttranslator.com/dev/ (http://www.microsofttranslator.com/dev/)
So Let us start
First I am going to create a Service Application that offer the SayHello Service. Open Visual Studio 2010,
Go to File -> New Project, from your preferred language from the templates section select WCF, select
WCF service application as the project type, give the project a name(I named it as HelloService), click ok
so that visual studio will create the project for you. In this demonstration, I have used C# as the
programming language.

(https://mscblogs.blob.core.windows.net/media/sreejukg/Media/clip_image002_4E47683B.jpg)
Visual studio will create the necessary files for you to start with. By default it will create a service with
name Service1.svc and there will be an interface named IService.cs. The screenshot for the project in
solution explorer is as follows

(https://mscblogs.blob.core.windows.net/media/sreejukg/Media/clip_image003_03EC87C9.png)

http://weblogs.asp.net/sreejukg/create-and-consume-wcf-service-using-visual-studio-2010

2/28

3/10/2014

K. G. Sreeju Nair - Create and Consume WCF service using Visual Studio 2010

Since I want to demonstrate how to create new service, I deleted Service1.Svc and IService1.cs files from
the project by right click the file and select delete.
Now in the project there is no service available, I am going to create one. From the solution explorer,
right click the project, select Add -> New Item
Add new item dialog will appear to you. Select WCF service from the list, give the name as
HelloService.svc, and click on the Add button.

(https://mscblogs.blob.core.windows.net/media/sreejukg/Media/clip_image005_36DC1830.jpg)
Now Visual studio will create 2 files with name IHelloService.cs and HelloService.svc. These files are
basically the service definition (IHelloService.cs) and the service implementation (HelloService.svc). Let
us examine the IHelloService interface.

(https://mscblogs.blob.core.windows.net/media/sreejukg/Media/clip_image006_66A69424.png)
The code state that IHelloService is the service definition and it provides an operation/method (similar
to web method in ASMX web services) named DoWork(). Any WCF service will have a definition file as an
Interface that defines the service.
Let us see what is inside HelloService.svc

(https://mscblogs.blob.core.windows.net/media/sreejukg/Media/clip_image007_78730224.png)
The code illustrated is implementing the interface IHelloService. The code is self-explanatory; the
HelloService class needs to implement all the methods defined in the Service Definition. Let me do the
service as I require.
http://weblogs.asp.net/sreejukg/create-and-consume-wcf-service-using-visual-studio-2010

3/28

3/10/2014

K. G. Sreeju Nair - Create and Consume WCF service using Visual Studio 2010

Open IHelloService.cs in visual studio, and delete the DoWork() method and add a definition for
SayHello(), do not forget to add OperationContract attribute to the method. The modified
IHelloService.cs will look as follows

(https://mscblogs.blob.core.windows.net/media/sreejukg/Media/clip_image008_367BF709.png)
Now implement the SayHello method in the HelloService.svc.cs file. Here I wrote the code for SayHello
method as follows.

(https://mscblogs.blob.core.windows.net/media/sreejukg/Media/clip_image009_366BD13C.png)
I am done with the service. Now you can build and run the service by clicking f5 (or selecting start
debugging from the debug menu). Visual studio will host the service in give you a client to test it. The
screenshot is as follows.

(https://mscblogs.blob.core.windows.net/media/sreejukg/Media/clip_image011_3A29760C.jpg)
In the left pane, it shows the services available in the server and in right side you can invoke the service.
To test the service sayHello, double click on it from the above window. It will ask you to enter the
parameters and click on the invoke button. See a sample output below.

http://weblogs.asp.net/sreejukg/create-and-consume-wcf-service-using-visual-studio-2010

4/28

3/10/2014

K. G. Sreeju Nair - Create and Consume WCF service using Visual Studio 2010

(https://mscblogs.blob.core.windows.net/media/sreejukg/Media/clip_image013_7B7478A5.jpg)
Now I have done with the service. The next step is to write a service client.
Creating a consumer application involves 2 steps. One generating the class and configuration file
corresponds to the service. Create a project that utilizes the generated class and configuration file. First
I am going to generate the class and configuration file.
There is a great tool available with Visual Studio named svcutil.exe, this tool will create the necessary
class and configuration files for you. Read the documentation for the svcutil.exe here
http://msdn.microsoft.com/en-us/library/aa347733.aspx (http://msdn.microsoft.com/enus/library/aa347733.aspx) .
Open Visual studio command prompt, you can find it under Start Menu -> All Programs -> Visual Studio
2010 -> Visual Studio Tools -> Visual Studio command prompt

(https://mscblogs.blob.core.windows.net/media/sreejukg/Media/clip_image014_5FEF76A2.png)
Make sure the service is in running state in visual studio. Note the url for the service(from the running
window, you can right click and choose copy address). Now from the command prompt, enter the
svcutil.exe command as follows.

(https://mscblogs.blob.core.windows.net/media/sreejukg/Media/clip_image015_03C82830.png)

http://weblogs.asp.net/sreejukg/create-and-consume-wcf-service-using-visual-studio-2010

5/28

3/10/2014

K. G. Sreeju Nair - Create and Consume WCF service using Visual Studio 2010

I have mentioned the url and the /d switch for the directory to store the output files(In this case
d:\temp). If you are using windows drive(in my case it is c: ) , make sure you open the command prompt
with run as administrator option, otherwise you will get permission error(Only in windows 7 or windows
vista).
The tool has created 2 files, HelloService.cs and output.config.
Now the next step is to create a new project and use the created files and consume the service. Let us do
that now. I am going to add a console application to the current solution. Right click solution name in the
solution explorer, right click, Add-> New Project
Under Visual C#, select console application, give the project a name, I named it TestService

(https://mscblogs.blob.core.windows.net/media/sreejukg/Media/clip_image017_41750FEC.jpg)
Now navigate to d:\temp where I generated the files with the svcutil.exe. Rename output.config to
app.config.
Next step is to add both files (d:\temp\helloservice.cs and app.config) to the files. In the solution
explorer, right click the project, Add -> Add existing item, browse to the d:\temp folder, select the 2 files
as mentioned before, click on the add button.

(https://mscblogs.blob.core.windows.net/media/sreejukg/Media/clip_image019_4CBE2429.jpg)
Now you need to add a reference to the System.ServiceModel to the project. From solution explorer,
right click the references under testservice project, select Add reference. In the Add reference dialog,
select the .Net tab, select System.ServiceModel, and click ok

http://weblogs.asp.net/sreejukg/create-and-consume-wcf-service-using-visual-studio-2010

6/28

3/10/2014

K. G. Sreeju Nair - Create and Consume WCF service using Visual Studio 2010

(https://mscblogs.blob.core.windows.net/media/sreejukg/Media/clip_image020_500F9604.png)
Now open program.cs by double clicking on it and add the code to consume the web service to the main
method. The modified file looks as follows

(https://mscblogs.blob.core.windows.net/media/sreejukg/Media/clip_image021_1CA3ACDB.png)
Right click the testservice project and set as startup project. Click f5 to run the project. See the sample
output as follows

(https://mscblogs.blob.core.windows.net/media/sreejukg/Media/clip_image022_2BF70EEA.png)
Publishing WCF service under IIS is similar to publishing ASP.Net application. Publish the application to a
folder using Visual studio publishing feature, create a virtual directory and create it as an application.
Dont forget to set the application pool to use ASP.Net version 4.
One last thing you need to check is the app.config file you have added to the solution. See the element
client under ServiceModel element. There is an endpoint element with address attribute that points to
the published service URL. If you permanently host the service under IIS, you can simply change the
address parameter to the corresponding one and your application will consume the service.

(https://mscblogs.blob.core.windows.net/media/sreejukg/Media/clip_image024_0A2B3659.jpg)
You have seen how easily you can build/consume WCF service. If you need the solution in zipped format,
please post your email below.
http://weblogs.asp.net/sreejukg/create-and-consume-wcf-service-using-visual-studio-2010

7/28

3/10/2014

K. G. Sreeju Nair - Create and Consume WCF service using Visual Studio 2010

119 Comments
Very useful. Thank you.
Fabrizio - Wednesday, December 15, 2010 9:48:52 AM (/sreejukg/create-and-consume-wcfservice-using-visual-studio-2010#comment-1319)

this blog is very useful for understanding of wcf in simple way


bharath - Friday, December 24, 2010 10:14:15 AM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1320)

excellent..very useful..thanks Sreeju


Srini - Wednesday, December 29, 2010 10:37:27 PM (/sreejukg/create-and-consume-wcfservice-using-visual-studio-2010#comment-1321)

Very excellent...very easy to understand...good job..


Ashwini - Thursday, January 6, 2011 5:04:19 AM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1322)

Thanks much
Taj - Tuesday, February 8, 2011 6:30:33 PM (/sreejukg/create-and-consume-wcf-service-usingvisual-studio-2010#comment-1323)

Great article... Very good explanation. Keep it up :)


Aswin - Tuesday, February 22, 2011 12:15:11 PM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1324)

Hey, very informative and interesting. Looks like you put a lot of effort and
research into it. Keep up the good work!
dubturboreview (http://www.dubturboreviewfree.com) - Saturday, February 26, 2011 5:33:06
AM (/sreejukg/create-and-consume-wcf-service-using-visual-studio-2010#comment-1325)

http://weblogs.asp.net/sreejukg/create-and-consume-wcf-service-using-visual-studio-2010

8/28

3/10/2014

K. G. Sreeju Nair - Create and Consume WCF service using Visual Studio 2010

Thank you
Sarath - Wednesday, March 2, 2011 6:34:14 AM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1326)

Excellent Post for beginner


Faisal Ahmed - Monday, March 21, 2011 7:24:40 AM (/sreejukg/create-and-consume-wcfservice-using-visual-studio-2010#comment-1327)

excellent article..
Ananda N - Wednesday, April 6, 2011 9:33:05 AM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1328)

very good and easy example..


Chirag kavathiya - Thursday, April 21, 2011 6:25:01 AM (/sreejukg/create-and-consume-wcfservice-using-visual-studio-2010#comment-1329)

It is very useful for beginner


Latha - Wednesday, May 4, 2011 9:44:26 AM (/sreejukg/create-and-consume-wcf-service-usingvisual-studio-2010#comment-1330)

Much appreciated.
Ravi - Thursday, May 5, 2011 1:44:56 AM (/sreejukg/create-and-consume-wcf-service-usingvisual-studio-2010#comment-1331)

really amazing , nice article for begineers.


Extremelly thanks a lot
shashank patel - Wednesday, May 18, 2011 6:28:09 AM (/sreejukg/create-and-consume-wcfservice-using-visual-studio-2010#comment-1332)

http://weblogs.asp.net/sreejukg/create-and-consume-wcf-service-using-visual-studio-2010

9/28

3/10/2014

K. G. Sreeju Nair - Create and Consume WCF service using Visual Studio 2010

Thanks so much for your excellent article. This is an awsome post to a beginner
like me.
Just wonder if you can also post the screen shots for exactly how to publish
this wcf service under IIS.
Many thanks in advance
Emiriic - Tuesday, May 24, 2011 1:13:23 AM (/sreejukg/create-and-consume-wcf-service-usingvisual-studio-2010#comment-1333)

Thank you so much! I'm not familiar with MVS and the MVS 10 new
features..So, this article really helped!
Merci!
Tib - Wednesday, May 25, 2011 9:44:35 AM (/sreejukg/create-and-consume-wcf-service-usingvisual-studio-2010#comment-1334)

Thanks a lot for your article! Could you please suggest what is "change the
address parameter to the corresponding one" in App.config? I am new with
WCF services.
Ivan - Thursday, June 2, 2011 9:14:03 PM (/sreejukg/create-and-consume-wcf-service-usingvisual-studio-2010#comment-1335)

This article is very easy to understand and to follow. Thanks a TON! Please do
keep writing such good articles!
Devi - Thursday, June 2, 2011 9:23:08 PM (/sreejukg/create-and-consume-wcf-service-usingvisual-studio-2010#comment-1336)

I try to call the same in window service I am getting some error, can you
explain how to consume this wcf thru window services...for the same example
Murali - Monday, June 13, 2011 11:54:10 PM (/sreejukg/create-and-consume-wcf-service-usingvisual-studio-2010#comment-1337)

http://weblogs.asp.net/sreejukg/create-and-consume-wcf-service-using-visual-studio-2010

10/28

3/10/2014

K. G. Sreeju Nair - Create and Consume WCF service using Visual Studio 2010

could you give us a sample where a web application projet is consuming a WCF
app
Thanks
rodolfo - Tuesday, June 14, 2011 12:07:27 AM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1338)

Thanks for providing this article


Sabariraj K - Thursday, June 23, 2011 2:27:06 PM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1339)

A.W.E.S.O.M.E.. simple and works perfectly! Thank you!


Sajjan - Thursday, June 23, 2011 5:31:29 PM (/sreejukg/create-and-consume-wcf-service-usingvisual-studio-2010#comment-1340)

thank you very much.


www.SuperShaadi.com
SuperShaadi.com (http://www.SuperShaadi.com) - Wednesday, June 29, 2011 9:50:19 PM
(/sreejukg/create-and-consume-wcf-service-using-visual-studio-2010#comment-1341)

hi,i need a sample code for practical point of view.


if have some doubt if more then one service than how to set app config.
pls provide me sample code on below link
chakravorty.sanjay@gmail.com
sanjay - Wednesday, July 6, 2011 12:30:57 PM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1342)

http://weblogs.asp.net/sreejukg/create-and-consume-wcf-service-using-visual-studio-2010

11/28

3/10/2014

K. G. Sreeju Nair - Create and Consume WCF service using Visual Studio 2010

So the project type is wcf service library not wcf service application because if i
go with service application i don't get wcf test application am i missing
something?
kiwi - Monday, July 11, 2011 10:07:58 PM (/sreejukg/create-and-consume-wcf-service-usingvisual-studio-2010#comment-1343)

I got working after seeing this article


Bhhagya - Thursday, July 14, 2011 1:33:51 PM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1344)

After seeing this article no need of any training.Excellent way of


explanation.Thanks a lot.
Neetu - Friday, July 22, 2011 4:35:22 AM (/sreejukg/create-and-consume-wcf-service-usingvisual-studio-2010#comment-1345)

Great article. I have a better understanding of WCF now.


Sifiso - Monday, July 25, 2011 2:01:10 PM (/sreejukg/create-and-consume-wcf-service-usingvisual-studio-2010#comment-1346)

Nicely done. Thanks a mill.


Sifiso - Monday, July 25, 2011 2:18:56 PM (/sreejukg/create-and-consume-wcf-service-usingvisual-studio-2010#comment-1347)

Excellent article for those who have just started to learn about WCF. Much
appreciated.
Saad - Tuesday, July 26, 2011 12:29:25 PM (/sreejukg/create-and-consume-wcf-service-usingvisual-studio-2010#comment-1348)

http://weblogs.asp.net/sreejukg/create-and-consume-wcf-service-using-visual-studio-2010

12/28

3/10/2014

K. G. Sreeju Nair - Create and Consume WCF service using Visual Studio 2010

Hi,
First of all i thankful to you to give a simple manner solution for the first time
WCF service creation.
I have created successfully the WCF Service Application adn when trying to
consume then got the below error:
Please Help.
There was no endpoint listening at http://localhost:3587/HelloService.svc that
could accept the message. This is often caused by an incorrect address or
SOAP action. See InnerException, if present, for more details.
Thanks in Advance.
Regards,
Nishant Ranjan
Nishant Ranjan - Tuesday, August 2, 2011 1:23:17 PM (/sreejukg/create-and-consume-wcfservice-using-visual-studio-2010#comment-1349)

thnks..
gopal singh - Thursday, August 4, 2011 6:24:38 AM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1350)

Can you kindly tell which Service type this is?


SOAP, REST or JSON?
thnx
ssh - Monday, August 8, 2011 8:34:14 PM (/sreejukg/create-and-consume-wcf-service-usingvisual-studio-2010#comment-1351)

http://weblogs.asp.net/sreejukg/create-and-consume-wcf-service-using-visual-studio-2010

13/28

3/10/2014

K. G. Sreeju Nair - Create and Consume WCF service using Visual Studio 2010

I have a service function


... string GetValue(string aGroup, string aId)
which must read a value from a database table filtered on the aGroup & aId
parameter's.
How can I achieve this ?
I've tried...:
1) adding an Entity Data Model but I don't know how to reference it from my
*.svc.cs module.
2) Considered using WCF Data Service but I don't want ODATA ?
Any help would be appreciated
Alan - Wednesday, August 10, 2011 9:10:44 AM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1352)

Excellent job. A great way to just run a simple example. It helps to add more
detail explaining why each step is done and the significance of files generated.
Also, any alternative methods to generate files without using svcutil.exe.
Please keep it up. Great work!
Chris - Wednesday, August 10, 2011 11:01:37 PM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1353)

If i would like to host the WCF as a windows Service, wich extra steps i need to
do?, thanks in advance
Hostilio Macias - Tuesday, August 23, 2011 8:03:10 PM (/sreejukg/create-and-consume-wcfservice-using-visual-studio-2010#comment-1354)

Hi this article is very good for lanners


Thanks
Amarjith kumar (http://amarjith.ba@gmail.com) - Wednesday, August 24, 2011 2:34:27 PM
(/sreejukg/create-and-consume-wcf-service-using-visual-studio-2010#comment-1355)

http://weblogs.asp.net/sreejukg/create-and-consume-wcf-service-using-visual-studio-2010

14/28

3/10/2014

K. G. Sreeju Nair - Create and Consume WCF service using Visual Studio 2010

I think this is the simplest and most practical way of learning WCF services
Thanks a lot
Sid - Friday, August 26, 2011 7:14:17 PM (/sreejukg/create-and-consume-wcf-service-usingvisual-studio-2010#comment-1356)

Very simple and useful! great work!


Hyma - Tuesday, September 6, 2011 8:19:30 AM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1357)

Thanks a lot... I found this article very useful... Keep updating with such things!
Krantisinh - Tuesday, September 6, 2011 10:47:21 AM (/sreejukg/create-and-consume-wcfservice-using-visual-studio-2010#comment-1358)

Very good explanation and really helpfull.


Thanks
Keep posting :)
Praveen Mandalapu - Thursday, September 15, 2011 6:59:15 AM (/sreejukg/create-andconsume-wcf-service-using-visual-studio-2010#comment-1359)

superb artical,, Thanks alot


vrushali - Friday, September 16, 2011 10:39:39 AM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1360)

Beginner must read this article, who want to work in WCF and VS2010
Hari - Wednesday, September 21, 2011 12:17:20 PM (/sreejukg/create-and-consume-wcfservice-using-visual-studio-2010#comment-1362)

very nice article for beginners.


jyoti - Thursday, September 22, 2011 1:01:46 PM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1363)

http://weblogs.asp.net/sreejukg/create-and-consume-wcf-service-using-visual-studio-2010

15/28

3/10/2014

K. G. Sreeju Nair - Create and Consume WCF service using Visual Studio 2010

Excellent article..very useful n helpful for beginners..


Vaibhav Sharma - Friday, September 23, 2011 7:48:03 AM (/sreejukg/create-and-consume-wcfservice-using-visual-studio-2010#comment-1364)

excellent..very informative and understanding..very good for beginners..


Vibhu - Friday, September 23, 2011 8:20:26 AM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1365)

good for beginners


jfr - Monday, September 26, 2011 12:54:02 PM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1366)

Great article! Thank you


Kate Fox - Tuesday, September 27, 2011 3:47:51 PM (/sreejukg/create-and-consume-wcfservice-using-visual-studio-2010#comment-1367)

Wonderful article ! Thanks a lot. I think that it a great start for WCF. Thanks
again !
Christos - Thursday, September 29, 2011 10:06:49 AM (/sreejukg/create-and-consume-wcfservice-using-visual-studio-2010#comment-1368)

i need these topic in will you send me ......................


murali yadav (http://yadavakila1@gmail.com) - Friday, September 30, 2011 7:04:14 PM
(/sreejukg/create-and-consume-wcf-service-using-visual-studio-2010#comment-1369)

Good one but we need some realtime example that is general in use and can
think versetil on it.
Aadhar - Wednesday, October 5, 2011 1:01:30 PM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1370)

http://weblogs.asp.net/sreejukg/create-and-consume-wcf-service-using-visual-studio-2010

16/28

3/10/2014

K. G. Sreeju Nair - Create and Consume WCF service using Visual Studio 2010

Really Nice artical can you please send me wsDualHttpBinding


in WCF.on padwalpriyanka10@gmail.com
Priyanka - Tuesday, October 11, 2011 9:51:18 AM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1371)

greate article please send me code of this application my email id is


irfankhanamu@gmail.com
irfan - Wednesday, October 12, 2011 12:23:53 PM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1372)

Good One. Easy to understand.


Thank you Sreeju.
Prabu - Wednesday, October 12, 2011 5:03:42 PM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1373)

Very useful. Thank you.


Neethu - Tuesday, November 1, 2011 1:05:27 PM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1374)

Excellent work .....loved it


Rashmeet - Thursday, November 3, 2011 1:21:53 PM (/sreejukg/create-and-consume-wcfservice-using-visual-studio-2010#comment-1375)

how can it possible in visual studio 2008


vishal yadav - Tuesday, November 8, 2011 9:36:23 AM (/sreejukg/create-and-consume-wcfservice-using-visual-studio-2010#comment-1376)

Very nice!!! Thanks


Ranjith - Tuesday, November 8, 2011 2:06:41 PM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1377)

http://weblogs.asp.net/sreejukg/create-and-consume-wcf-service-using-visual-studio-2010

17/28

3/10/2014

K. G. Sreeju Nair - Create and Consume WCF service using Visual Studio 2010

@vishal yadav , Creating a WCF service application is absolutely possible with


Visual Studio 2008. refer this MSDN article, make sure you have Visual Studio
2008 selected as the version
sreejukg (http://weblogs.asp.net/sreejukg) - Wednesday, November 9, 2011 4:39:06 AM
(/sreejukg/create-and-consume-wcf-service-using-visual-studio-2010#comment-1378)

Great!!!
to work with WCF Services in Visual studio 2010.
Thanks !!!!!!
Smitha - Tuesday, November 15, 2011 3:28:51 PM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1379)

Great article. Worked like a charm and saved me a lot of hours programming
my first WCF service. Thanks a lot.
Per - Tuesday, November 15, 2011 6:40:18 PM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1380)

Great Article..Thanks...
tency - Wednesday, November 16, 2011 11:16:11 AM (/sreejukg/create-and-consume-wcfservice-using-visual-studio-2010#comment-1381)

Very good article, good for beginners


Jai - Monday, November 28, 2011 1:34:02 PM (/sreejukg/create-and-consume-wcf-service-usingvisual-studio-2010#comment-1382)

Thanks a Lot
I have got much better understanding of WCF now
U made my day :)
Bhargava S - Tuesday, November 29, 2011 2:25:41 PM (/sreejukg/create-and-consume-wcfservice-using-visual-studio-2010#comment-1383)

http://weblogs.asp.net/sreejukg/create-and-consume-wcf-service-using-visual-studio-2010

18/28

3/10/2014

K. G. Sreeju Nair - Create and Consume WCF service using Visual Studio 2010

I'm getting an error related to endpoint configuration. My client side


configuration is same as you have mentioned. Can us share the working sample
of this article.
Thanks
Mohit Kumar (http://mohitkumar111@hotmail.com) - Wednesday, December 7, 2011 7:22:27
AM (/sreejukg/create-and-consume-wcf-service-using-visual-studio-2010#comment-1384)

plz send the code


sairama (http://sairama40@rediff.com) - Wednesday, December 7, 2011 2:35:20 PM
(/sreejukg/create-and-consume-wcf-service-using-visual-studio-2010#comment-1385)

Very Useful tutorial for beginners...I need zip example codes..Please Send it to
my mail id: kumar.manish1983@gmail.com
Manish - Wednesday, December 14, 2011 10:51:48 PM (/sreejukg/create-and-consume-wcfservice-using-visual-studio-2010#comment-1386)

Excellent article for beginners...! very easy to understand. thanks for the
article.
arjun - Saturday, January 7, 2012 3:42:44 AM (/sreejukg/create-and-consume-wcf-service-usingvisual-studio-2010#comment-1387)

Excellent tutorial for beginners.Thanks a lot...


Mp - Thursday, January 12, 2012 11:35:25 AM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1388)

Ery useful thanks


Amulu - Thursday, January 19, 2012 8:20:52 PM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1389)

http://weblogs.asp.net/sreejukg/create-and-consume-wcf-service-using-visual-studio-2010

19/28

3/10/2014

K. G. Sreeju Nair - Create and Consume WCF service using Visual Studio 2010

It was really helpful we got what we expected.!!thanx a lot..!!


Iclarify software solution freshers 2011 (http://www.hoopla.co.in) - Friday, January 20, 2012
10:01:47 AM (/sreejukg/create-and-consume-wcf-service-using-visual-studio-2010#comment-1390)

Would be really helpful if the the images were READABLE!!! Some are so small
that all you can see is a blur.
Leo Mrozek - Monday, January 23, 2012 8:19:06 PM (/sreejukg/create-and-consume-wcfservice-using-visual-studio-2010#comment-1391)

@Leo Mrozek,
click on the images will give you bigger image view. Hope this clarifies your
question
sreejukg (http://weblogs.asp.net/sreejukg) - Tuesday, January 24, 2012 4:49:43 AM
(/sreejukg/create-and-consume-wcf-service-using-visual-studio-2010#comment-1392)

good artical
vivek - Wednesday, January 25, 2012 9:32:45 AM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1393)

Its really very good to understand easily. Thanks


Prabakaran M - Wednesday, January 25, 2012 3:00:37 PM (/sreejukg/create-and-consume-wcfservice-using-visual-studio-2010#comment-1394)

Excellent article...thnx
ganesh - Tuesday, January 31, 2012 7:11:57 AM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1395)

I can't able to access the WCF service in console App. do you know why it i so??
Gutlapalli - Wednesday, February 1, 2012 3:35:50 PM (/sreejukg/create-and-consume-wcfservice-using-visual-studio-2010#comment-1396)

http://weblogs.asp.net/sreejukg/create-and-consume-wcf-service-using-visual-studio-2010

20/28

3/10/2014

K. G. Sreeju Nair - Create and Consume WCF service using Visual Studio 2010

Very nice one!


Thank you!
Sakander - Thursday, February 2, 2012 10:56:22 AM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1397)

superbbbbb artical....
raj - Friday, February 3, 2012 10:49:04 AM (/sreejukg/create-and-consume-wcf-service-usingvisual-studio-2010#comment-1398)

Thank You.for given such helpful articles to beginner.


Nitin Kumar Dixit - Saturday, February 4, 2012 8:13:04 AM (/sreejukg/create-and-consume-wcfservice-using-visual-studio-2010#comment-1399)

very useful for a newbie like me, many thanks. the only thing i would say is that
there is no 'WCF service' project type anymore? i think its called 'WCF Service
Application' now...
tariq - Monday, February 6, 2012 2:47:27 PM (/sreejukg/create-and-consume-wcf-service-usingvisual-studio-2010#comment-1400)

thank you very much.It's a great blog.


maks - Thursday, February 9, 2012 8:14:38 AM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1401)

hey, file is not being created so i have problems with references.


any help?
i can pass web.config from wcf if is needed
guillermo - Thursday, February 9, 2012 4:58:26 PM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1402)

http://weblogs.asp.net/sreejukg/create-and-consume-wcf-service-using-visual-studio-2010

21/28

3/10/2014

K. G. Sreeju Nair - Create and Consume WCF service using Visual Studio 2010

great work buddy. Thanks, very very useful.


Ranjith V - Tuesday, February 14, 2012 7:35:42 AM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1403)

Very helpful!!!
Parth - Wednesday, February 15, 2012 4:07:24 PM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1404)

Thank you very much. This article is very useful for beginers.
I tried and it worked..
Rajesh - Tuesday, February 21, 2012 6:09:58 AM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1405)

Content is very helpful.


Thanks
Gaurav Dutt - Tuesday, February 21, 2012 7:35:13 AM (/sreejukg/create-and-consume-wcfservice-using-visual-studio-2010#comment-1406)

Thanks a lot.
Seeryx - Tuesday, February 21, 2012 4:59:56 PM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1407)

Thanks a Lot , it is very helpful for beginners


Nitin - Wednesday, February 22, 2012 6:26:22 AM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1408)

Good... Bein explicado simple y sencillo. Muchas gracias por el ejemplo.


Juan Iquise - Friday, February 24, 2012 4:59:09 PM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1409)

http://weblogs.asp.net/sreejukg/create-and-consume-wcf-service-using-visual-studio-2010

22/28

3/10/2014

K. G. Sreeju Nair - Create and Consume WCF service using Visual Studio 2010

Excelente explicacin!!
Josi - Friday, March 9, 2012 8:56:29 PM (/sreejukg/create-and-consume-wcf-service-using-visualstudio-2010#comment-1410)

it is a best reuqiremnt fullfillment


hitesh - Friday, March 16, 2012 6:10:10 AM (/sreejukg/create-and-consume-wcf-service-usingvisual-studio-2010#comment-1412)

Really good for beginners


Vijayan - Thursday, March 22, 2012 6:32:29 AM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1413)

The type or namespace name 'HelloServiceClient' could not be found (are you
missing a using directive or an assembly reference?)
can any one tell what reference should be added.
I have added the Service.Model reference.
venkat - Thursday, March 22, 2012 6:56:23 PM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1414)

It is very very helpful for me to understand the WCF.


Great article .Thanks a lot.
prabhulingayya - Monday, April 2, 2012 11:13:10 AM (/sreejukg/create-and-consume-wcfservice-using-visual-studio-2010#comment-1415)

http://weblogs.asp.net/sreejukg/create-and-consume-wcf-service-using-visual-studio-2010

23/28

3/10/2014

K. G. Sreeju Nair - Create and Consume WCF service using Visual Studio 2010

For Windows 7 svcutil.exe command Prompt:


Step1 : C:\>cd C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin
Step2 : C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin>svcutil
/d:d:\temp http://loca
lhost:55292/Service1.svc
Hariharan - Tuesday, April 3, 2012 6:35:50 AM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1416)

Thanks alot . bcz am a fresher in my company.So Am worried about how to do


wcf programs.But now I understood easily
DivyaBharathi - Wednesday, April 11, 2012 7:08:52 AM (/sreejukg/create-and-consume-wcfservice-using-visual-studio-2010#comment-1417)

please send me
bal krishn shukla (http://balkrishnshukla@gmail.com) - Saturday, April 14, 2012 4:15:19 PM
(/sreejukg/create-and-consume-wcf-service-using-visual-studio-2010#comment-1418)

Very good post for beginners


Vamsi - Friday, April 20, 2012 12:31:52 PM (/sreejukg/create-and-consume-wcf-service-usingvisual-studio-2010#comment-1419)

sss
sssss - Tuesday, April 24, 2012 7:57:57 AM (/sreejukg/create-and-consume-wcf-service-usingvisual-studio-2010#comment-1420)

http://weblogs.asp.net/sreejukg/create-and-consume-wcf-service-using-visual-studio-2010

24/28

3/10/2014

K. G. Sreeju Nair - Create and Consume WCF service using Visual Studio 2010

Very good post for beginners, iam trying this example ,when iam debug this i
got this error:
the contract 'IMetadataExchange'in client configuration does not match the
name in service Contract,or there is no valid method in this contract.
This is the error i got How can i Slove this Problem Please tell me the answer to
this
Mail ID:svreddy2006@gmail.com
srinu - Wednesday, May 2, 2012 6:51:07 AM (/sreejukg/create-and-consume-wcf-service-usingvisual-studio-2010#comment-1421)

thank you very much.


amila4d@gmail.com
Amila - Wednesday, May 9, 2012 4:43:39 AM (/sreejukg/create-and-consume-wcf-service-usingvisual-studio-2010#comment-1422)

G0OIYh I really liked your article post.Really looking forward to read more.
Great.
EnrdjAsQoBHzqfCC (http://XtKUjKrwByAnUBgqXt) - Monday, May 14, 2012 11:20:06 PM
(/sreejukg/create-and-consume-wcf-service-using-visual-studio-2010#comment-1423)

Very useful article..


Cute - Wednesday, May 16, 2012 10:02:34 AM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1424)

awesome post...very useful to understand wcf specially for beginners...


kuldeep - Thursday, May 17, 2012 11:05:28 AM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1425)

http://weblogs.asp.net/sreejukg/create-and-consume-wcf-service-using-visual-studio-2010

25/28

3/10/2014

K. G. Sreeju Nair - Create and Consume WCF service using Visual Studio 2010

Great article, for a beginners.


Yogesh Kapase - Tuesday, May 29, 2012 4:28:02 AM (/sreejukg/create-and-consume-wcfservice-using-visual-studio-2010#comment-1426)

Very good post buddy......


sssss - Wednesday, May 30, 2012 8:48:16 AM (/sreejukg/create-and-consume-wcf-service-usingvisual-studio-2010#comment-1427)

Nice post
Esay to reproduce, now i'm going to try to do another consuming an xml file
and adding the data in the xml to a database
Cheers!
Mortadelo - Thursday, May 31, 2012 3:37:39 PM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1428)

How can I get the code please


adryarza - Tuesday, June 5, 2012 1:59:39 PM (/sreejukg/create-and-consume-wcf-service-usingvisual-studio-2010#comment-1429)

thank you very much. Its really good. thanks thanks thanks :)
Jose M - Wednesday, June 6, 2012 2:36:42 PM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1430)

hello i need code .


verendra - Tuesday, June 12, 2012 7:06:21 AM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1431)

Good one!
senthilsaravanan - Tuesday, June 19, 2012 10:24:59 AM (/sreejukg/create-and-consume-wcfservice-using-visual-studio-2010#comment-1432)

http://weblogs.asp.net/sreejukg/create-and-consume-wcf-service-using-visual-studio-2010

26/28

3/10/2014

K. G. Sreeju Nair - Create and Consume WCF service using Visual Studio 2010

please send me the code. thngundu@yahoo.com


tawaz - Tuesday, June 19, 2012 10:58:53 AM (/sreejukg/create-and-consume-wcf-service-usingvisual-studio-2010#comment-1433)

How do you consume this service with web-form?


Shaan - Wednesday, June 20, 2012 5:52:27 AM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1434)

Could not find default endpoint element that references contract


'IHelloService' in the ServiceModel client configuration section. This might be
because no configuration file was found for your application, or because no
endpoint element matching this contract could be found in the client element.
Shahzad - Thursday, July 19, 2012 11:03:10 AM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1435)

cam anyone tell me where i am wrong....on my id shahzadbeg075@gmail.com


Shahzad - Thursday, July 19, 2012 11:11:54 AM (/sreejukg/create-and-consume-wcf-serviceusing-visual-studio-2010#comment-1436)

hmmm
aa - Monday, July 30, 2012 8:26:15 AM (/sreejukg/create-and-consume-wcf-service-using-visualstudio-2010#comment-1437)

oh well, on line promotion also takes a lot of


work just like offline promotion of products and services
Cassidy (http://reversephonelookupcellnumbers.blogspot.com/) - Tuesday, August 7, 2012
2:19:32 AM (/sreejukg/create-and-consume-wcf-service-using-visual-studio-2010#comment-1438)

Today is the first day i was looking at WCF and this was very helpful. Thanks
VJ - Friday, August 10, 2012 5:08:30 AM (/sreejukg/create-and-consume-wcf-service-usingvisual-studio-2010#comment-1439)

http://weblogs.asp.net/sreejukg/create-and-consume-wcf-service-using-visual-studio-2010

27/28

3/10/2014

K. G. Sreeju Nair - Create and Consume WCF service using Visual Studio 2010

Comments have been disabled for this content.

Terms Of Use (http://www.asp.net/terms-of-use) - Powered by Orchard (http://www.orchardproject.net)

http://weblogs.asp.net/sreejukg/create-and-consume-wcf-service-using-visual-studio-2010

28/28