views:

110

answers:

2

I have 2 WCF services now and I want to construct the WCF Service which will use 2 WCF Services(trying to make coarse-grained service).But as you know for making wcf service; create wcf service library and I construct all methods ,write on WCF Service Library.And then I create New Web Site which is WCF Service and I link it to WCF Service Library.

But there exist a problem at that moment; I can't use WCF Service References in the WCF Service Libraries..NET FrameWork can't use wcf service methods in independent WCF Service Library.What is the solution ? The problem is a bit confusing but I think a lot of people are trying to solve this problem ...

A: 

You have to move/merge configuration of the referenced WCF services from app.config of your WCF Service Library, to the Web Site's web.config. Everything else should work out of the box.

Mike Chaliy
I use the service references( for service methods) in Service Libraries.And in Web Site WCF Service Application in my .svc there is no information about the methods which is implemented in library.So how can I make configuration about my methods in my .svc config file
Look, WCF even for service references requires config. By default Visual Studio generate this config to the app.config. Unfortunately, Web Site will not see this config. This means that you need to merge this configs. This is the only way.
Mike Chaliy
A: 

But there exist a problem at that moment; I can't use WCF Service References in the WCF Service Libraries..NET FrameWork can't use wcf service methods in independent WCF Service Library.

?? What do you mean by that?? That doesn't make sense at all. Can you please explain a bit more what you have and what doesn't work??

My "best practice" approach is to have at least two projects for a WCF service:

1) Contracts: all contracts (service, operation, data, fault) go here - only the contracts, nothing else.

2) Service implementation: the actual service code - the code that implements those contracts

Optionally, I might have a third project for hosting the service, not relevant in your case if you have hosting in IIS.

On the client side, I typically also use two projects:

1) ClientProxies which contains all the proxies / service references for others to use

2) Client(s) are the ultimate users of my service - an Winforms App, a WPF app, ASP.NET etc.

I use this approach a lot and I've never had any trouble with not being able to use a service reference or anything, as you say.....

marc_s