在Windows应用程序中调用webservice [英] Call webservice in windows application
问题描述
我有一个Windows应用程序,我要求用户通过在网站中提供给用户的用户名和密码登录应用程序。为此,首先我检查用户是否连接到互联网。如果有连接,则继续检查凭证是否有效。所以,我需要在windows应用程序中调用webservice。
I have a windows application and I require that the user logins in the application by the username and password which were provided to the user in the website. For this purpose, firstly I check whether the user is connected to internet or not. If there is a connection, then proceeds to check whether the credentials are valid or not. So, I need to call a webservice in the windows application. How do I proceed in this?
欢迎任何解释在Windows应用程序中调用webservice的过程的示例。
Any examples explaining the procedure to call webservice in windows application are welcome.
推荐答案
查看此 answer 的SO线程和代码项目文章 - Web服务与Win Forms和Web窗体进一步移动。
Check this answer on SO Thread and Code project article - Webservice with Win Forms and Web Forms to move further.
要在visual studio中使用Web服务,请检查以下步骤...
To consume web service in visual studio, check the steps below...
- 在Visual Studio中右键单击项目
- 选择添加Web引用
- 输入网址&继续
当您看不到该选项时
When you don't see that option
- 在Visual Studio中右键点击项目
- 选择添加服务参考
- 按高级按钮
- 按添加Web引用按钮
- 输入网址&继续
- Right click on the Project in Visual Studio
- Select Add Service Reference
- Press "Advanced" Button
- Press "Add Web Reference" Button
- Enter URL & proceed
参考:
创建ASP.NET Web服务并使用Win Form
编辑:
System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable()
应该得到你想检查的互联网等。
System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable()
should get you what you want to check the internet etc..
参考:
如何确定Internet连接是否可用于您的WinForms应用程序?
和
使用.NET检测互联网连接的最佳方法是什么?
这篇关于在Windows应用程序中调用webservice的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!