开发者

Calling a separate WCF service from an n-tier WCF Service in Visual Studio

开发者 https://www.devze.com 2023-02-20 23:20 出处:网络
We have a couple of different services for our different apps that are all hosted on the same server. For a solution we are trying to implement now - we want to reuse some code (or methods actually) f

We have a couple of different services for our different apps that are all hosted on the same server. For a solution we are trying to implement now - we want to reuse some code (or methods actually) from another service - rather than duplicating code either through copying the project or even the class from the other service.

Our services are set up so each layer is a different project in studio, so it looks like this (and we are using Visual Studio 2010)

-Sol开发者_StackOverflow中文版ution

-- Service.Data

-- Service.BusinessLayer

-- Service.WindowsService (the exe)

We want to call the other service from the Business Layer in our case for right now.

How is the right way to call the other service? (or is there a better method all together to handle this that we are missing?).


Add the service reference to you Service.BusinessLayer project this should create an app.config in this project. Then copy the client section and binding section from your app.config to the app.config of your Service.WindowsService. This should enable what you want to do, call a service from your Service.BusinessLayer project. For cleanup you can delete the app.config from your Service.BusinsssLayer project.

Good Luck!


You could move the interfaces for your common services into a separate (and shared) library. The implementations can stay where they are.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号