使用 Wcf 客户端使用 asmx 服务? [英] Consume asmx service With Wcf Client?

查看:36
本文介绍了使用 Wcf 客户端使用 asmx 服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个旧的 asmx 服务.(不是我的)

I have an old asmx service on the air. ( Not Myne)

我想通过 wcf 消费它.

I want to consume it by wcf.

我想用传统的方式(ABC)

And i want to do it by the traditional way ( ABC)

A = 我有.

B = 简单的 http 绑定(旧 asmx)

B = Simple http Binding ( old asmx)

C = XXX ???//<-- 我如何获得合同?SVCUTIL ?

C = XXX ??? //<-- how do i get the Contract ? SVCUTIL ?

推荐答案

B = 简单的 http 绑定(旧 asmx)

B = Simple http Binding ( old asmx)

它将是 basicHttpBinding.

C = XXX ???//<-- 我如何获得合同?SVCUTIL ?

C = XXX ??? //<-- how do i get the Contract ? SVCUTIL ?

是的,您使用 svcutil.exe 或 Visual Studio 中的添加服务引用对话框以生成强来自 asmx 服务的 WSDL 的类型化代理:

Yes, you use svcutil.exe or the Add Service Reference dialog in Visual Studio to generate a strongly typed proxy from the WSDL of the asmx service:

svcutil.exe http://example.com/legacy.asmx?WSDL

svcutil.exe 还将为您生成一个 app.config 文件,其中包含 <client> 部分以及用于使用服务的正确端点.

svcutil.exe will also generate an app.config file for you containing the <client> section with the correct endpoint to be used to consume the service.

这篇关于使用 Wcf 客户端使用 asmx 服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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