How to use WCF service
We have 2 projects in our company, the 2nd calls the 1st through the WCF service that is hosted by ASP.NET web site.
My idea was to deploy asp.net with hosted WCF service and the 2nd team will add 'service reference' to their project. and using auto-generated classes will instantiate client for service and call its methods.
But, they insist me to create a DLL that will contains a interface (contract) implemented by WCF service and they will add reference to those DLL. And only using this interface from dll they are going to communicate.
What is a correct approach for 'consuming' WCF service?
P.开发者_C百科S. I've read a lot about how to consume/host WCF service, but still can see a best approach for that.
P.P.S. We are working under VS 2008, .NET 3.5, but ideas for VS2010 and .NET 4.0 are also welcome.
So team 2 wants you to create a client implementation they can include in their project? Seems like laziness to me. Sounds like you guys need to hash out what your corporate SOA strategy is. If there is no strategy (or hope of getting one). Team 2 should create their own project, with a facade they can reference if needed.
It is trivial to generate a client proxy dll for 2nd team. Use the svcutil command line tool in windows SDK to generate a proxy class and then use msbuild to build a proxy dll. This can even be automated in your build process and the dll is dropped to a known shared location on each build.
That said this is not best practice for SOA as for SOA the WSDL should define the interface and that is what you should provide to 2nd team. This can be via an url or as a file drop.
精彩评论