使用WCF Test Client(WcfTestClient.exe) 来测试WCF
2009-10-09 11:35
501 查看
写完一个WCF 应用程序的时候,用IE浏览器并不怎么容易测试WCF 是否正确运行,更无法自定义参数了。当然我们可以写一个简单的客户端程序去测试,参看这里 。 不过,上海紫竹科技园的微软WCF tool team 开发了一个小工具 WcfTestClient.exe 可以帮助我们非常方便地测试WCF应用。
在C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\ 可以找到这个工具双击就可以运行。
为了说明这个小工具的使用,我拿前面文章里
的一个WCF 作为例子。客户端调用WCF 需要知道WCF的结构以及配置信息,也就是WSDL 信息。那个例子只有一个非常简单的endpoint.
现在往web.config文件里 一个MEX节点以便客户端发现WCF的结构, 最后Web.config 的内容是这样的:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<services>
<service name="WCFLib.StockService" behaviorConfiguration="MEXServiceTypeBehavior">
<endpoint address="" binding="wsHttpBinding" contract="WCFLib.IStockService"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MEXServiceTypeBehavior">
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
然后在工具里添加 新的WCF, 右键点击My Service Project 点Add Service. 填入地址http://localhost:8002/WCFApp1/StockService.svc
除了可以看图形界面外,还可以以xml 的方式查看WCF 的运行过程。
这个工具其实是利用了svcutil.exe 这个工具,如果运行中提示找不到svctuil.exe 可以参看Steven Cheng 回答的post:
http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/dc1e33c3-bd41-4389-8728-49f60ba4f1ab
相关参考资料: http://msdn.microsoft.com/en-us/library/bb552364.aspx http://blogs.msdn.com/wcftoolsteamblogcn/archive/2009/01/12/test.aspx
在C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\ 可以找到这个工具双击就可以运行。
为了说明这个小工具的使用,我拿前面文章里
的一个WCF 作为例子。客户端调用WCF 需要知道WCF的结构以及配置信息,也就是WSDL 信息。那个例子只有一个非常简单的endpoint.
现在往web.config文件里 一个MEX节点以便客户端发现WCF的结构, 最后Web.config 的内容是这样的:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<services>
<service name="WCFLib.StockService" behaviorConfiguration="MEXServiceTypeBehavior">
<endpoint address="" binding="wsHttpBinding" contract="WCFLib.IStockService"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MEXServiceTypeBehavior">
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
然后在工具里添加 新的WCF, 右键点击My Service Project 点Add Service. 填入地址http://localhost:8002/WCFApp1/StockService.svc
除了可以看图形界面外,还可以以xml 的方式查看WCF 的运行过程。
这个工具其实是利用了svcutil.exe 这个工具,如果运行中提示找不到svctuil.exe 可以参看Steven Cheng 回答的post:
http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/dc1e33c3-bd41-4389-8728-49f60ba4f1ab
相关参考资料: http://msdn.microsoft.com/en-us/library/bb552364.aspx http://blogs.msdn.com/wcftoolsteamblogcn/archive/2009/01/12/test.aspx
相关文章推荐
- 关于[使用 WCF 测试客户端 (WcfTestClient.exe)]
- 使用WCFTestClient工具来测试WCF Service
- 如何用WcfTestClient.exe测试C#写的WebService服务
- 使用SvcUtil.exe生成客户端代码和配置、WCF Test Client调试WCF
- WCF 测试客户端 (WcfTestClient.exe)
- wcftestclient.exe测试WCF服务
- 使用 WcFTestClient.exe 调试 wcf 服务
- wcftestclient.exe测试WCF服务
- 使用 WcFTestClient.exe 调试 wcf 服务
- WCF Development Tools -- WcfSvcHost.exe & WcfTestClient.exe
- 怎么使用 ab.exe 测试多个url。 how to use ab.exe test many url
- WcfTestClient.exe 路径
- Web API 自动生成帮助文档并使用Web API Test Client 测试
- wcf创建发布调试_WcfTestClient.exe
- mysql自带测试用例集mysql_client_test的使用
- 使用Android Studio进行UI测试与Record Espresso Test自动生成测试代码
- MSDN Webcast - 使用Windows Mobile Test Framework进行自动化测试(Level 300)
- Python中的测试模块unittest和doctest的使用教程
- 基于funambol ds 的云同步服务研究(五)-结合Sync Client的测试使用