简体   繁体   English

在C#中添加Web参考

[英]Adding Web Reference in C#

我是C#的新手,可以告诉我如何向我的项目添加网络引用以及应该选择哪种项目

A Web reference enables a project to consume one or more XML Web services. Web引用使项目可以使用一个或多个XML Web服务。 Use the Add Web Reference Dialog Box to search for Web services locally, on a local area network, or on the Internet. 使用“添加Web参考”对话框可以在本地,局域网或Internet上搜索Web服务。

After adding a Web reference to your current project, you can call any methods exposed by the Web service. 将Web引用添加到当前项目后,您可以调用Web服务公开的任何方法。

To add a Web Reference 添加Web参考

  1. On the Project menu, click Add Web Reference. 在项目菜单上,单击添加Web参考。
  2. In the URL box of the Add Web Reference dialog box, type the URL to obtain the service description of the Excel Web Services, such as http:////_vti_bin/excelservice.asmx or http:///_vti_bin/excelservice.asmx. 在“添加Web引用”对话框的“ URL”框中,键入URL以获取Excel Web Services的服务描述,例如http:////_vti_bin/excelservice.asmx或http:///_vti_bin/excelservice.asmx 。 Then click Go to retrieve information about the Web service. 然后单击“执行”以检索有关Web服务的信息。 Note Note: 注意注意:

    You can also open the Add Web Reference dialog box in the Solution Explorer pane by right-clicking References and selecting Add Web Reference. 您也可以通过右键单击“引用”并选择“添加Web引用”,在“解决方案资源管理器”窗格中打开“添加Web引用”对话框。

  3. In the Web reference name box, rename the Web reference to ExcelWebService. 在“ Web引用名称”框中,将Web引用重命名为ExcelWebService。
  4. Click Add Reference to add a Web reference for the target Web service. 单击“添加引用”以为目标Web服务添加Web引用。
  5. Visual Studio downloads the service description and generates a proxy class to interface between your application and Excel Web Services. Visual Studio将下载服务描述并生成一个代理类,以在您的应用程序和Excel Web Services之间建立接口。

Read

How to: Add and Remove Web References 如何:添加和删除Web引用

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

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