1

I have a WCF in Visual Studios 2012 with .NET Framework 4.5 which I've ran to create a localhost development server. I also have a class library project in Visual Studios 2008 with .NET Framework 3.5 that can only add Web References, which I've done to connect to the local host dev server above. Unfortunately, I cannot seem to access the Web Reference or any of the functions therein.

Is this possible? And if so, any idea what step I'm missing?

I'm in VS 2008 because it is actually .NET Compact Framework 3.5 which adds some restrictions, but if it's possible with regular .NET Framework 3.5 I can probably get it to work with the compact framework then.

Thanks!

Anduril28
  • 303
  • 1
  • 3
  • 15

2 Answers2

0

If your WCF service uses BasicHttpBinding, you should be able to use it with a web reference. Just find the endpoint address of the service (like a url ending in .svc), append ?wsdl to the end, and add the web reference to that (and make sure that http get style metadata publishing is enabled in the wcf service behavior).

fejesjoco
  • 11,763
  • 3
  • 35
  • 65
  • I have found the endpoint address (currently http://localhost:51997/MyService.svc) previously, but this time I did add ?wsdl to the end and it did show one of the functions in the window, but I'm still unable to access or even find the service from my code (i.e. Naming it 'MyService', and not being able to find MyService.MyFunction()). And I'm also not sure how to enable http get style metadata publishing. – Anduril28 Nov 02 '14 at 22:39
  • Look for a class that derives from SoapHttpClientProtocol. That's your client, instantiate that and therein you should find your service methods. – fejesjoco Nov 03 '14 at 06:17
  • Nothing.. I can add the web reference, and I can see it when I access the object browser, but other than that, nothing. – Anduril28 Nov 03 '14 at 15:33
  • Check in Windows Explorer if a file named Reference.cs has been added. Or better yet, show a picture of what's inside your Web References folder in Windows Explorer. – fejesjoco Nov 03 '14 at 15:41
  • See, there's your Reference.cs. There must be a webservice client class in it. – fejesjoco Nov 04 '14 at 06:39
-1

I couldn't get the Web Reference working, but I did find out a way to use the web services as a Service Reference. I used these resources:

http://blogs.msdn.com/b/robcamer/archive/2009/12/21/wcf-in-net-compact-framework-3-5.aspx

http://blogs.msdn.com/b/andrewarnottms/archive/2007/09/13/calling-wcf-services-from-netcf-3-5-using-compact-wcf-and-netcfsvcutil-exe.aspx

I used Power Toys for .NET compact framework to create two file which I added to the solution, then used as you would normally use a Service Reference.

Anduril28
  • 303
  • 1
  • 3
  • 15