Skip to main content
 首页 » 编程设计

c#之在 C# 中添加 Web 引用

2024年01月29日29wuhuacong

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

请您参考如下方法:

A Web reference enables a project to consume one or more XML Web services. Use the Add Web Reference Dialog Box to search for Web services locally, on a local area network, or on the Internet.

After adding a Web reference to your current project, you can call any methods exposed by the Web service.

添加 Web 引用

  1. 在“项目”菜单上,单击“添加 Web 引用”。
  2. 在“添加 Web 引用”对话框的 URL 框中,键入 URL 以获取 Excel Web 服务的服务描述,例如 http:////_vti_bin/excelservice.asmx 或 http:///_vti_bin/excelservice.asmx。然后单击 Go 检索有关 Web 服务的信息。 注意注意:

    您还可以通过右键单击“引用”并选择“添加 Web 引用”,在“解决方案资源管理器” Pane 中打开“添加 Web 引用”对话框。

  3. 在 Web 引用名称框中,将 Web 引用重命名为 ExcelWebService。
  4. 单击“添加引用”为目标网络服务添加网络引用。
  5. Visual Studio 下载服务描述并生成一个代理类来连接您的应用程序和 Excel Web 服务。

阅读

How to: Add and Remove Web References