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.
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
again.
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.
Nilee
Member
457 Points
111 Posts
Added a web reference, still need to add a proxy class generated via svcutil.exe
Mar 02, 2012 09:40 AM|LINK
Hi All,
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.
Please help.
Thank you!
Regards,
Tapasya
Please mark the post as 'Answer' if it helps you!!
naveenreddy....
Member
135 Points
104 Posts
Re: Added a web reference, still need to add a proxy class generated via svcutil.exe
Mar 02, 2012 10:05 AM|LINK
Hi,
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.
thanks
Greater Noida
kushalrdalal
Contributor
7130 Points
1271 Posts
Re: Added a web reference, still need to add a proxy class generated via svcutil.exe
Mar 02, 2012 01:39 PM|LINK
Once you add web reference you should able to consume it without adding proxy class.
My Blog
LinkedIn Profile
Steven Cheng...
Contributor
4197 Points
547 Posts
Microsoft
Moderator
Re: Added a web reference, still need to add a proxy class generated via svcutil.exe
Mar 05, 2012 03:09 AM|LINK
Hi Nilee,
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 again.
#Walkthrough: Creating and Accessing WCF Services
http://msdn.microsoft.com/en-us/library/bb386386.aspx
#Add Service Reference Dialog Box
http://msdn.microsoft.com/en-us/library/bb386382.aspx
BTW, "Add ServiceREferece" can also be used to create proxy classes for consuming traditional ASMX webservice.
Feedback to us
Microsoft One Code Framework
Nilee
Member
457 Points
111 Posts
Re: Added a web reference, still need to add a proxy class generated via svcutil.exe
Mar 07, 2012 07:35 AM|LINK
Hi Steven,
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.
Regards,
Tapasya
Please mark the post as 'Answer' if it helps you!!
Steven Cheng...
Contributor
4197 Points
547 Posts
Microsoft
Moderator
Re: Added a web reference, still need to add a proxy class generated via svcutil.exe
Mar 08, 2012 07:09 AM|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.
Feedback to us
Microsoft One Code Framework