Last post Mar 08, 2012 07:09 AM by Steven Cheng - MSFT
Mar 02, 2012 09:40 AM|Nilee|LINK
New bie in WCF.
Trying to consume a WCF service in a library project. Added a web reference of the same.
But still do I need to generate the proxy class via svcutil.exe as w/o adding this class, My consumer class is not able to recognize the service.
Mar 02, 2012 10:05 AM|naveenreddy.gopu|LINK
basically if you want to consume webservice in your applicaion, add service reference with your solution explorer. with this it generates the proxy class file of that service. and now you can access the class file in your web/windows application
i don't think so again generate the proxy class with svcutil.exe. with command also you can generate proxy class. and add it to your solution explorer.
Mar 02, 2012 01:39 PM|kushalrdalal|LINK
Once you add web reference you should able to consume it without adding proxy class.
Mar 05, 2012 03:09 AM|Steven Cheng - MSFT|LINK
For consuming WCF service in .NET client project(app or class library), you should use the "Add ServiceReference..." wizard (rather than Add WebReference...) in Visual Studio. "Web Reference" is for traditional asmx webservice and might not work for some WCF
service which have used advanced features. Also, as for the svcutil.exe, generally it is a command line tool for generating the WCF service proxy, if you have already used "Add ServiceReference" to generate the proxy, you no longer need to use svcutil.exe
#Walkthrough: Creating and Accessing WCF Services
#Add Service Reference Dialog Box
BTW, "Add ServiceREferece" can also be used to create proxy classes for consuming traditional ASMX webservice.
Mar 07, 2012 07:35 AM|Nilee|LINK
Thank you for your time.
I am adding a service refernce only. Apologies for the mistake.
When I try adding a service reference in a new project it works perfectly fine. But in my current project, its not working.
I tried the things mentioned in the links as well. But dint work.
In the end I have now removed the service reference. Generated the proxy through svcutil.exe and added that to the project. That works.
Mar 08, 2012 07:09 AM|Steven Cheng - MSFT|LINK
Thanks for reply Nilee,
Just in case you still want a try. You can try creating a new fresh project(the same project type as the current one) and add servicereference against the service (make sure it works). Then add the project items from existing project to the new one. This often
works in case there is something corrupt with the project setting or VS IDE related stuffs.