12.1 C
HomeDevelopmentWeb Reference vs. Service Reference

Web Reference vs. Service Reference

I’m learning that one of the biggest hurdles to getting back into the day-to-day development game is that a minor wrong turn can send you down a misguided path for a couple of days. If you’re not coding daily, your development intuition muscle doesn’t respond like it used to. I ran into this issue the other day when trying to consume the Community Megaphone API.

The first hint that I was doing something seriously wrong is when I suggested to Andrew Duthie (developer of Community Megaphone, and Mid-Atlantic Microsoft Developer Evangelist) that his documentation was a bit outdated, and he reacted with surprise. I got the familiar “been-out-of-programming-too-long inferiority complex” feeling in the pit of my stomach, which, by the way, absolutely has to be worked through to get back into programming “shape”.

After a couple of email exchanges, he asked me if I added a web reference to the web service URL of the API. I quickly began my intended response, claiming that I definitely did, when something clicked — this is an “original” web service. An ASMX. Not a WCF service (Andrew wrote it before .NET 3.0 was out). I checked and saw that I added a Service Reference, which was surfaced back in Visual Studio 2008 I believe, and it used to sit side-by-side in the context menu with Add Web Reference. But in VS 2010 (and apparently in VS 2008?), the Web Reference option looks to be deprecated. You now have to select Add Service Reference, click the Advanced button, and then click the Add Web Reference button:



Apparently, my initial selection of Service Reference caused the creation of a proxy where all the classes were appended with “SoapClient”, which totally confused me. The functionality still worked for the most part when instantiating those classes, but I was not making use of the proxy / interface intended for its use. That’s what caused me to claim that the API documentation was wrong.

So the moral of my story is, don’t confuse Service Reference with Web Reference. In the current version of VS you have to get through one to select the other, but if you start noticing “SoapClient” appended to the class names, that should be a hint that you’re referencing a ASMX web service via WCF.

I’m still digging into the mechanics of this behavior.  I’m sure there’s a completely logical reason.  And when I fully understand it (comments would help here), I will blog about it.  But in the meantime, consider this a public service announcement.

And when doing development in .NET 3.0 or later, just use WCF instead.


latest articles

explore more


  1. Thanks for this post, I have just been down this same path and have been stymied when trying to access the web service on a remote server. The service call fails because it requires credentials and one cannot assign credentials to the service reference.

  2. I just wanted to say that nothing has ever been more true than your very first sentence of this article, lol! Thank you.

  3. i had the same problem in MVC when add reference to the project

    i had the hunch of mistake just few mins ago before arriving here but given me more information regarding to topic

    thanks alot

  4. Thanks…I just did the exact same thing… added a Service reference instead of a web reference… this article really helped!

  5. Thanks, I saved a lot of time. I started working first time in web services. I was having lot of question related to web reference and service references.

  6. yo sigo con el mismo problema me truena al consumir el servicio no se si sea por las crdenciales que tengo que enviar


Please enter your comment!
Please enter your name here