如何使用内存中现有的 WSDL 来创建 WCF 服务? [英] How to use existing in memory WSDL in order to create WCF service?

查看:30
本文介绍了如何使用内存中现有的 WSDL 来创建 WCF 服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

1) 我知道当我们想使用现有的 WCF 服务时,WSDL 文件是在客户端生成的.这是为了防止我们在 Visual Studio 中使用添加服务引用..."选项.我不明白的是 - 当我们使用客户端代理调用 WCF 服务时,究竟在什么时候使用 WSDL 文件?

1) I know that WSDL file is generated on client side when we want to use existing WCF service. This is in case we use "Add Service Reference..." option in Visual Studio. What I don't understand is - at what moment exactly WSDL file is used when we use the client proxy to invoke WCF service?

2)在创建WCF服务的过程中,我不知道如何使用或连接或附加内存中存在的WSDL.我的意思是我应该写什么?类似的东西:

2) I don't know how to use or connect or attach existing in memory WSDL in the process of creation WCF service. I mean what should I write? Something like:

Uri mexAddress = new Uri("http://localhost:2240/Service1.svc?wsdl");

或:

Uri mexAddress = new Uri("http://localhost:2240/Service1.svc?" + SomeName.wsdl);

或:

?

提前致谢.

戈兰

推荐答案

1) 我知道 WSDL 文件是在我们想要的时候在客户端生成的使用现有的 WCF 服务.这是在我们使用添加服务"的情况下参考..."选项在 Visual Studio 中.我不明白的是 - 在当我们使用客户端代理时,确切地使用了 WSDL 文件的哪个时刻调用 WCF 服务?

1) I know that WSDL file is generated on client side when we want to use existing WCF service. This is in case we use "Add Service Reference..." option in Visual Studio. What I don't understand is - at what moment exactly WSDL file is used when we use the client proxy to invoke WCF service?

不,wsdl 是在服务器端生成的.它是描述服务的基于 XML 的文档.它指定服务的位置以及服务公开的操作或方法.添加服务引用时,Visual Studio(或 svcutil)会保存此 wsdl 的副本,仅用于生成客户端代理.wsdl 将永远不会在那一代之后使用,并且不会嵌入到资源中.您也可以在没有 wsdl 的情况下创建客户端代理.

No, the wsdl is generated at server-side. It is the XML based document that describes a Service. It specifies the location of the service and the operation or methods the service exposes. When adding a service reference, Visual Studio (or svcutil) save a copy of this wsdl only for generating a client proxy. The wsdl will never be used after that generation and is not embedded in ressources. You can also create a client proxy without a wsdl.

2) 我不知道如何使用或连接或附加内存中现有的WSDL 在创建 WCF 服务的过程中.我的意思是我应该怎么做写?

2) I don't know how to use or connect or attach existing in memory WSDL in the process of creation WCF service. I mean what should I write?

不清楚.你的意思是 ?在服务器端,当您激活元数据的展示时,WCF 将自动管理 WSDL 创建(它也是可扩展的).

Unclear. What do you mean ? On server-side, WCF will automatically manage the WSDL creation (it is also extensible) when you activate the expostion of metadata .

这篇关于如何使用内存中现有的 WSDL 来创建 WCF 服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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