发现解决方案中的 WCF 服务 [英] Discover WCF services in Solution

查看:37
本文介绍了发现解决方案中的 WCF 服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个工作正常的 WCF 服务解决方案.我在解决方案中添加了一个小型控制台应用程序,该应用程序需要对同一解决方案中的服务进行服务引用.它发现了该服务,但显然无法连接到它,因为该服务未运行.如何在 Visual Studio 2010 中让服务在解决方案中运行,同时在同一解决方案中添加服务引用?

I have a solution with a WCF service which works fine. I have added a small console app in the solution which needs to have a Service reference to the service in the same solution. It discovers the service but obviously can't connect to it as the service is not running. How in Visual Studio 2010 I can have the service running in the solution and at the same time add a service reference in the same solution?

推荐答案

假设客户端应用程序与 WCF 服务项目在同一个解决方案中,右击客户端应用程序并选择添加服务引用".

Assuming the Client Application is in the same solution as the WCF Service project, r-click the client application and choose "Add Service Reference".

将显示一个对话框,您可以通过单击右上角标有发现"的按钮来选择您的服务.

A dialogue is displayed allowing you to select your Service by clicking the button in the top right labelled "Discover".

假设绑定设置正确并且可用于 WCF 服务(通过 app.config 文件或类似文件),IDE 将自动为您托管服务.- 请注意,app.config 应位于 WCF 服务项目中,除非解决方案中的另一个项目中已有指定的主机可用.

Assuming the binding is correctly set and available for the WCF Service (via an app.config file or similar) the IDE will automatically host the service for you. - note, the app.config should be located within the WCF Service project unless there is a designated host already available in another project within the solution.

如果托管服务有任何问题,则会出现一个新对话框,其中服务端点的右侧列显示错误".单击错误行将解释出现问题的原因,并希望能帮助您解决问题.

If there are any issues hosting the service, a new dialogue will appear, with the right hand column for your service endpoints saying "Error". Clicking the errored line will explain why there is an issue and hopefully help you to resolve it.

这篇关于发现解决方案中的 WCF 服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆