在Windows应用程序中调用webservice [英] Call webservice in windows application

查看:150
本文介绍了在Windows应用程序中调用webservice的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个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...


  1. 在Visual Studio中右键单击项目

  2. 选择添加Web引用

  3. 输入网址&继续



当您看不到该选项时



When you don't see that option


  1. 在Visual Studio中右键点击项目

  2. 选择添加服务参考

  3. 按高级按钮

  4. 按添加Web引用按钮

  5. 输入网址&继续

  1. Right click on the Project in Visual Studio
  2. Select Add Service Reference
  3. Press "Advanced" Button
  4. Press "Add Web Reference" Button
  5. 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屋!

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