简体   繁体   English

WCF KnownTypes参考生成

[英]WCF KnownTypes reference generation

I have a WCF service that has one BaseForm that is inherited numerous time (100+), some (10+) have multi-layered inheritance too. 我有一个WCF服务,该服务具有一个被无数次继承(100+)的BaseForm,一些(10+)也具有多层继承。 All of the derived forms are listed as KnownTypes. 所有派生形式都列为KnownTypes。

The problem I am having is the time it takes for the service to start up and to generate a client reference. 我遇到的问题是服务启动并生成客户端引用所花费的时间。 Using the WCF Test Client as a test it takes about 10 minutes for it to complete. 使用WCF测试客户端作为测试,大约需要10分钟才能完成。 If I don't reference the KnowTypes (or just list a couple) it takes about 1.5 mins to fully complete. 如果我不引用KnowTypes(或仅列出几个),则大约需要1.5分钟才能完全完成。

Is there anyway to see what is going on, why it is taking so long? 无论如何,有没有看到正在发生的事情,为什么要花这么长时间? Or is there a better way than the standard? 还是有比标准更好的方法?

Cheers 干杯

How big is the WSDL generated for your service? 为您的服务生成的WSDL有多大? Depending on how large those known types are, you are potentially including a huge amount of data in the 'service reference' or proxy. 根据这些已知类型的大小,您可能会在“服务引用”或代理中包含大量数据。

Every object that you include as a KnownType will be added to the WSDL or service metadata. 您作为KnownType包含的每个对象都将添加到WSDL或服务元数据中。 This will include, at a minimum, 至少包括

  • the fully qualified name of the object (including namespace and xml namespace) 对象的标准名称(包括名称空间和xml名称空间)
  • list of all properties on the object 对象上所有属性的列表
  • description of all types of all properties, ie non simple types can have large descriptions. 所有属性的所有类型的描述,即非简单类型可以具有较大的描述。

When you connect to the service to request metadata, as the WCF test client does when you provide a service URL, it will need to 当您连接到服务以请求元数据时,就像WCF测试客户端在提供服务URL时所做的那样,它将需要

  1. Ask the service to generate this metadata document, and the service will investigate all the objects and their properties 要求服务生成此元数据文档,服务将调查所有对象及其属性
  2. Send this content over the wire - not a big deal but not free 通过有线发送此内容-没什么大不了,但不是免费的
  3. Deserialize into a proxy; 反序列化为代理; in the WCF test client this means generating the fields on the form that relate to each property type for each object. 在WCF测试客户端中,这意味着在表单上生成与每个对象的每种属性类型相关的字段。

What can you do about this? 您能对此做什么? You probably don't need to do anything. 您可能不需要执行任何操作。 This is a one time operation - once your service client knows the types that will can be sent and received it stores them (as generated code) and reuses them. 这是一次操作-一旦您的服务客户端知道将要发送和接收的类型,它将存储它们(作为生成的代码)并重用它们。

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

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