Charu
Charu

Reputation: 2717

Not able to add a Web reference to a WCF Service library using basicHttpBinding

I have two instances of VS2010 running on same machine.One VS instance has a WCF service with basicHttpBinding. Now as i have read in books, for calling this WCF service with basicHttpBinding, i have to Add a Web reference to it rather than Service Reference. I ran the project containing the WCF service and from other VS instance try to add a Web reference, this is the URL which i gacve(I got it from WCFClientHost )

http://localhost:8732/Design_Time_Addresses/WcfServiceLibraryBasicHttpBinding/Service1/mex

But i get Http 400 error everytime i try to add the WCF service. Please let know what i am doing wrong.

Upvotes: 1

Views: 1196

Answers (1)

marc_s
marc_s

Reputation: 755157

You should keep two things apart:

  • Add Service Reference adds a service interface based on the .NET 3.0 and up WCF runtime. It supports all WCF bindings - including basicHttpBinding

  • Add Web Reference is the old-style, .NET 1.x/2.x method of adding a reference to an ASMX web service ("ASP.NET web service"). This technology is outdated, and has been fully replaced by WCF as of .NET 3.0. ASMX only ever supported what is more or less equivalent to basicHttpBinding.

    The ASMX technology is outdated, and you should only ever use this if you really can't make WCF work (but in my 3 years of writing and consuming a plethora of web services, I have never seen such a case) - avoid this unless you absolutely can't make WCF work - for whatever weird reason that might be...

The link you gave to the CodeProject article has a entirely plain wrong statement that you need to use Add Web Reference for basicHttpBinding - that is just plain NOT TRUE.

Upvotes: 1

Related Questions