The Difference Between “Add Web Reference” and “Add Service Reference”
2010-03-18 16:16
393 查看
I was playing around with building a simple WCF ASP.NET client in
Visual Studio 2008 and wanted to make a reference to my WCF service
(that used basicHttpBinding). I have built plenty of ASMX web services
in the past so simply selected “Add Web Reference” as I’d done before,
pointed to my .svc file hosted in IIS, and away I went – everything
worked as expected.
Then I spied the “Add Service Reference” menu option and thought – hey that’s weird I wonder what that does?
Well it’s pretty simple really.
Add Web Reference is a wrapper over wsdl.exe
and can be used to create proxies for .NET 1.1 or 2.0 clients. Of
course this means when you are pointing to a WCF service you have to be
pointing to an endpoint that uses basicHttpBinding (as I was).
Add Service Reference is a wrapper over svcutil.exe and also creates clients proxies (and additionally web.config entries). These proxies, however, can only be consumed by .NET 3.0+ clients.
It seems to me that a better approach would have been to have a
single menu option that allowed you to select the proposed target
framework.
Visual Studio 2008 and wanted to make a reference to my WCF service
(that used basicHttpBinding). I have built plenty of ASMX web services
in the past so simply selected “Add Web Reference” as I’d done before,
pointed to my .svc file hosted in IIS, and away I went – everything
worked as expected.
Then I spied the “Add Service Reference” menu option and thought – hey that’s weird I wonder what that does?
Well it’s pretty simple really.
Add Web Reference is a wrapper over wsdl.exe
and can be used to create proxies for .NET 1.1 or 2.0 clients. Of
course this means when you are pointing to a WCF service you have to be
pointing to an endpoint that uses basicHttpBinding (as I was).
Add Service Reference is a wrapper over svcutil.exe and also creates clients proxies (and additionally web.config entries). These proxies, however, can only be consumed by .NET 3.0+ clients.
It seems to me that a better approach would have been to have a
single menu option that allowed you to select the proposed target
framework.
相关文章推荐
- The Difference Between “Add Web Reference” and “Add Service Reference”
- The Difference Between “Add Web Reference” and “Add Service Reference”
- Difference between WCF and Web API and WCF REST and Web Service
- what the difference between __weak and __block reference?
- The difference between web container and web server
- Difference between WCF and Web API and WCF REST and Web Service[转]
- What are the differences between WebAPI and WebAPI 2
- What the difference between __weak and __block reference?
- What is the difference between addView and addViewInLayout?
- Preparing for Application and Service Deployment-Differences Between the Storage Emulator and Window
- What exactly is the difference between “pass by reference” in C and in C++?
- more effective c++:the difference between pointer and reference
- What the difference between __weak and __block reference?
- What is the difference between application server and web server?
- The Difference Between @Helpers and @Functions In WebMatrix
- What is the difference between Web Farm and Web Garden?
- What are the differences between a pointer variable and a reference variable in C++?
- Difference between WCF and Web API and WCF REST and Web Service
- The difference between java application library and java web lib
- The difference between Web role and Worker role in windows azure platform