Offhand I think the problem and solution here are the same as they would be in C# - if your clients and servers are sharing the same code, then you should use 'shared contracts' and not have a svcutil.exe step. Put your contracts in an assembly, and have both clients and servers reference that assembly. (Is there another reason you were using svcutil?)

By on 4/6/2010 9:06 AM ()

you should use 'shared contracts' and not have a svcutil.exe step.

Put your contracts in an assembly, and have both clients and servers

reference that assembly. (Is there another reason you were using

svcutil?)

But, if I don't use svcutil.exe, who is going to generate the code that serializes the data types (to be transmitted from the client to the server and viceversa)?

Also, I cannot seem to find any reference about "shared contracts". Could you give me some link?

Thanks again

By on 4/6/2010 1:04 PM ()

There's no code needed to serialize the data; by marking up types with DataContract attributes, the DataContract serializer knows how to do it, it 'just works'.

Yeah, it seems too hard to find good docs on sharing contract assemblies. Here are a couple links I found that discuss using ChannelFactory to create clients without needing svcutil:

[link:www.clariusconsulting.net]

[link:msdn.microsoft.com]

svcutil is mostly needed in scenarios where the client and server are different parties, e.g. someone has some web service in the cloud (that maybe they authored with a Java stack), but it exposes WSDL and talks standardized web protocols, and you want to create a C# client to talk to it. Point svcutil at the WSDL and it will generate the client code, which includes the service contracts, data contracts, and proxy classes. But in an internal app (e.g. for your intranet), you can pass code/assemblies around, so you can just put your contracts in mycontracts.dll, and have both your service and your clients reference that assembly and code against that, no code-gen needed.

By on 4/6/2010 2:59 PM ()

You rock Brian.

I did not know about shared contracts. WCF is so big I am lost. I was using svcutil just because this is what the chapter I have read wanted me to do. In WCf books, I did not know what to look for. Now you gave me that keyword I should not have problems. Thanks again! [H]

By on 4/6/2010 12:09 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper