Reputation: 13
just want to know what happens behind the seen when we create a wcf service in a project and add service reference in another project. So to know it i am doing it all without Visual Studio i.e. writing service code in notepad files and using command line to run svcutil.exe. My question is do i need to run svcutil at both side (service side and client side) to export and import metadata? And what files at minimum are generated by svcutil.exe.
Thanks friends.
Upvotes: 1
Views: 3069
Reputation: 17492
SvcUtil
will generate a proxy class and a configuration file which will specify things such as the bindings the service uses, security credentials, read quotas, the address of the service, the contract etc. SvcUtil
will generate the metatadata, serialization code and so on. You run SvcUtil
on the service machine and the two files it gives you (proxy class and configuration file) may be used to create clients on different machines.
Typically these are also generated by the visual studio 'add service reference' feature so you don't really have to use SvcUtil. Visual studio actually uses SvcUtil
behind
the scenes to generate the client proxy, so it seems a bit less 'messy' to use Visual Studio for generating client proxies.
In SOA terms some argue that generatting clients manually using SvcUtil or Visual Studio is not good practise since thes etools generate unnecessary code with too much coupling and don't give you much flexibility. You can separate your assemblies, such as your services, contarcts, proxies etc. and create service channels using the ChannelFactory
class. This nice article is a proponent of the latter practice of generating client proxies.
Upvotes: 3