如何测试.Net Web服务 [英] How to test .Net Web Service

查看:115
本文介绍了如何测试.Net Web服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我对.net Web服务比较陌生.我正在编写一个Web服务,并且可以在Visual Studio 2008内置的Development Server中对其进行测试.

现在,我想从Windows应用程序调用Web服务.编写Web服务代码时,如何以及在测试Web服务时调试Web服务?我是否需要运行IIS并将asmx文件放入wwwroot?还是可以用其他方法进行测试和调试.

我需要编写Web服务代码并通过同时从WinForm调用它来对其进行测试

谢谢

Hi,

I am rather new to .net web services. I am writing a web service and I can test it under Visual Studio 2008 built-in Development Server.

Now, I want to call the web service from a windows application. How can test and debug the web service as and when I write the web service code? Do I need to run IIS and put the asmx file into the wwwroot? or can I test and debug it some other way.

I need to write the web service code and test it by calling it from the WinForm at the same time

Thank you

推荐答案

如果需要同时调试Web服务和WinForms应用程序,则需要在它们自己的Visual Studio实例中运行它们-即运行VS的2个实例.

您不需要使用IIS-您的WinForms应用程序可以连接到内置的Development Server-只需确保在WinForms应用程序之前启动Web服务即可.

尼克
If you need to debug both the web service and the WinForms app at the same time, you need to run them both in their own instance of Visual Studio - i.e. run 2 instances of VS.

You don''t need to use IIS - your WinForms app can connect to the built-in Development Server - just make sure to start the web service before the WinForms app!

Nick


太好了!感谢您的快速解答.

另一个疑问.那么,如何将网络参考设置为asmx?如果我同时运行两个实例,它将通过localhost可用?

开发人员用于从Winform测试Web服务的常用标准是什么?
Thats great! Thanks for the quick answer.

One more doubt. How do I set the web reference to the asmx, then? It will be available through localhost if I run both instances at the same time?

What is the usual standard that developers use for testing web service from a winform?


尼克,

谢谢您的解决方案.

实际上,根据您的回答,我在VS2008上进行了一些尝试,并找到了解决方案:添加项目功能非常方便.

首先,就像在component/dll项目中一样,启动一个Web服务项目并向其中添加Windows Forms项目.这将使您能够运行VS的单个实例,并同时调试Web和Winform应用程序.

无论如何,感谢您的深思熟虑

Neji
Hi Nick,

Thank you for the solution.

In fact, since your answer, I played around VS2008 a little bit and found a solution: Add Project feature, which is very handy.

You first start a Web service project and add a Windows Forms project to it just as we do in component/dll projects. This will enable you to run single instance of VS and debug both web and winform application simultaneously.

Thank you for the food for thought, anyway

Neji


这篇关于如何测试.Net Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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