1

I'm little bit confused about "Add reference" and "Add service reference" in case of WCF service. I checked it on internet and MSDN but did not find any suitable answer.The actual problem I'm facing due to lack of understanding this, is questioned here (Add service reference gives Exception: Unable to connect to remote server).

I tried to find that, add service reference is invoking svcutil.exe and add reference is just adding dll. However, this did not give me clear idea.What actually internally happens in both the case? If Add reference is working fine with basic HTTP connection, why add service reference would not work?

Please help me understand without down grading this question.I'm tiring to find out the solution to my problem.

Community
  • 1
  • 1
AskMe
  • 2,495
  • 8
  • 49
  • 102
  • You said things are not working but you never actually explained how it is not working. Please edit your question and add details about what errors you are getting. – Scott Chamberlain Jul 23 '15 at 15:49
  • I have explained every thing that I have tried and errors here: http://stackoverflow.com/questions/31579822/add-service-reference-gives-exception-unable-to-connect-to-remote-server – AskMe Jul 23 '15 at 15:55

2 Answers2

2

Use add service reference when you are adding a web service reference to the solution and needs a proxy to call the service functions. You add reference in case when you have another project and you want to add it as a library or add any external library.

From MSDN: "A service reference enables a project to access one or more Windows Communication Foundation (WCF) services"

"The Add Reference dialog box can be used either to add or to delete project references"

man_luck
  • 1,605
  • 2
  • 20
  • 39
1

When you use "Add Reference", you are adding a reference to a dynamic-link library so you can reuse code.

When you add a Service Reference, you are asking Visual Studio to generate stubs in order to call some service running on a possibly separate machine.

For example, if example.com exposes a soap service for credit card processing, you would click on Add Service Reference and enter "example.com" in the address bar. If example.com sends you a credit card processing library in the form of a dll, you would use "Add Refererence".

Add Service Reference - exposed as a WCF / SOAP etc

Add Reference - exposed as a file ending in .dll

  • Thanks for your answer. Make some sense to me. Could you please look into problem here: http://stackoverflow.com/questions/31579822/add-service-reference-gives-exception-unable-to-connect-to-remote-server – AskMe Jul 23 '15 at 15:59