简体   繁体   English

通过GUI在Visual Studio中添加服务引用时,它会做什么?

[英]What does it do when you add a service reference in Visual Studio, through the GUI?

I'm currently trying to call a WCF service dynamically See here , therefore, I'm trying to understand what happens behind, when I add a service reference by the GUI of Visual Studio... What's generated..? 目前,我想要动态调用WCF服务在这里看到 ,因此,我试图了解发生了什么后面,当我添加由Visual Studio的GUI服务引用...什么是生成..? An object is created and an implicit reference is created... 创建一个对象并创建一个隐式引用...

Are the references contained in a specific container, a sort of pool? 引用是否包含在特定的容器(一种池)中?

When you add a service reference, VS generates a proxy class for the service. 添加服务引用时,VS会为服务生成一个代理类。 This class implements the interface defined by your service endpoint as its ServiceContract, so it appears to consuming code as if it were the actual object performing the operations, but it contains and uses the communication channel defined by the endpoint and bindings to call the exposed service methods. 此类将服务端点定义的接口实现为其ServiceContract,因此看起来好像在消费代码,就像它是执行操作的实际对象一样,但是它包含并使用由端点定义的通信通道和绑定来调用公开的服务。方法。

If you do not have classes that conform to the signatures of the DataContracts required by the service, VS will generate those classes as well, but if you have already referenced classes that are marked identically to the DataContract (usually because you've referenced the project containing the DataContracts in the project with the client-side code) it will simply use those. 如果您没有符合服务要求的DataContracts签名的类,则VS也会生成这些类,但是如果您已经引用了与DataContract标记相同的类(通常是因为您已引用项目)包含带有客户端代码的项目中的DataContracts),它将仅使用这些代码。 Svcutil (the command-line tool) can be given a reference list of locations for these DataContracts as well. 也可以为Svcutil(命令行工具)提供这些DataContract的位置参考列表。

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

相关问题 “添加服务参考”的真正作用是什么? - What does “Add Service Reference” really do? Visual Studio的“添加服务引用”如何反序列化对象? - How does Visual Studio's “Add Service Reference” deserialize objects? 无法在Visual Studio中添加服务引用 - Failing to add a service reference in Visual Studio 如何在 Visual Studio 2017 中添加服务引用 - How to add service reference in visual studio 2017 Visual Studio添加服务参考发现凭据 - Visual Studio Add Service Reference discovery credentials Visual Studio 2015添加服务参考 - Visual Studio 2015 Add Service Reference 在Visual Studio 2010中使用“添加Web引用”添加服务时,如何访问服务方法? - How to Access the Service method when service is added using “Add Web Reference” in Visual Studio 2010? 如何在带代理的Visual Studio 2010中添加库包引用? - How do you add a Library Package Reference in Visual Studio 2010 with proxy? 如何使用“添加服务参考”从Visual Studio中调用php服务 - How to call php Service from visual studio with “Add Service Reference” 添加服务引用时,Visual Studio不会生成客户端代理代码 - Visual Studio does not generate client proxy code when adding service reference
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM