views:

216

answers:

2

In the bank I work all client workstations have .Net 2 installed it is outside my control to influence or get a newer version of the framework installed at the client end. On the server end I have more control and can write a .Net 3.5 WCF service if I choose.

I've an existing fat client that I'd like to refactor and shift it's data access code (Oracle Odp.net) to the server behind a service (to remove the client workstation dependency on the Oralce 10g client).

My question is if I put this data layer behind a WCF service can I access this from a .Net 2.0 GUI app on the client? or does the client workstation also need .net 3.0/3.5?

I've not used WCF much other than a few prototype apps on my dev machine connecting to a Windows 2003 Server which has .Net 3.5 SP1 so I am looking for advice.

Another consideration is that IIS is considered a red light technology (banned without dispensation) in this bank

Update

I have my WCF service running hosted in a Console App, I echo to the Console output when it receives and processes a call. On my Client .net 2 end I've chosen add Web Reference and make the call. But I get an error, even though I get the error the echo to console out is still generated on the Server end so it is being received just not return properly. The error is:

Exception: The underlying connection was closed: An unexpected error occurred on a receive.

Inner Exception: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.

How to fix this?

+7  A: 

If the WCF service exposes a basicHttpBinding endpoint, then .NET 2.0 (or any other code that uses SOAP) should be able to consume it with no problems.

John Saunders
Dammit - beat me to it by a few seconds... ;)
ZombieSheep
You can also user a REST biding and access it with WebClient.
RA
What .Net 2 Library/Classes should I use for consuming a WCF sevice with a basicHttpBinding endpoint? some example code would be excellent.
m3ntat
You don't need any examples, really. Just use "Add Web Reference", just like ASMX.
John Saunders
Ok and on the server end how do I run this and have this sitting there waiting to server incoming requests? I don't have IIS available to me so do I need to in addition to my WCF project write a console app that starts the WCF service and leave that running? or do this from a Windows service?
m3ntat
A Windows Servicw would be thw next easiest way, after IIS.
John Saunders
Ok I have my WCF service running hosted in a Console App, I echo to the Console output when it receives and processes a call. On my Client .net 2 end I've chosen add Web Reference and make the call. But I get an error, even though I get the error the echo to console out is still generated on the Server end. The error is:Exception: The underlying connection was closed: An unexpected error occurred on a receive.Inner Exception: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.How to fix this?
m3ntat
I output the servicehost.State and is Opened, I don't understand what the problem is...
m3ntat
Make sure that there are no errors occurring in the service. Use the WCF Configuration tool to edit the app.config on the service to turn on logging. Save the config file and build the console application again. Start the service and run the client application. Then use the svctraceviewer tool from a Visual Studio Command Window to view the resulting .svclog file.I recently did this and found I was throwing invisible exceptions.
John Saunders
+1  A: 

Would it be an option for you to expose the services through a basicHttpBinding, emulating asmx-style behaviour?

I'm afraid this is the best answer I can give at the moment, since I am fortunate enough to not have to retro fit into older .Net apps.

ZombieSheep