简体   繁体   English

如何从 FitNesse 调用 WCF 服务

[英]How to call a WCF service from FitNesse

When calling a WCF service from a console app, asp.net app, wpf/winform app, you have to have a app.config or web.config file for the WCF service endpoint information. When calling a WCF service from a console app, asp.net app, wpf/winform app, you have to have a app.config or web.config file for the WCF service endpoint information. But from FitNesse, I'm calling a fixture which is a.dll (class library) and this fixture is calling my WCF service.但是从 FitNesse,我调用了一个夹具,它是 a.dll(类库),这个夹具正在调用我的 WCF 服务。 It can't call the service because I can't include the endpoint information that it needs - because DLLs can't have app.config files.它不能调用服务,因为我不能包含它需要的端点信息——因为 DLL 不能有 app.config 文件。 Any ideas on how to call a WCF service from FitNesse.关于如何从 FitNesse 调用 WCF 服务的任何想法。

Anything you can do with a config in WCF can also be done programmatically.您可以通过 WCF 中的配置执行的任何操作也可以通过编程方式完成。 Could you create the endpoints in code and then compile it?你能在代码中创建端点然后编译它吗?

I had to place my app.config file in the dotnet directory of FitNesse.我不得不将我的 app.config 文件放在 FitNesse 的 dotnet 目录中。 I also had to add a path to that config file in my FitNesse page, like this.我还必须在我的 FitNesse 页面中添加该配置文件的路径,就像这样。

:path C.\fitnesse20090214\fitnesse\dotnet\app.config :路径 C.\fitnesse20090214\fitnesse\dotnet\app.config

A similar approach that I have working is to make a copy of the app.config for the testrunner.我正在使用的一种类似方法是为测试运行者制作 app.config 的副本。
So I make a copy of app.config as FitServer.exe.config (and TestRunner.exe.config) as a post build step in my fixture project.因此,我将 app.config 的副本作为 FitServer.exe.config(和 TestRunner.exe.config)作为我的夹具项目中的后期构建步骤。
As the previous post indicates, the config file needs to be in the same directory as the runner.如上一篇文章所述,配置文件需要与运行器位于同一目录中。

This worked with the 1.6 version of the fitnesse.Net runners as well as the latest 20090214 release.这适用于 Fitnesse.Net 跑步者的 1.6 版本以及最新的 20090214 版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM