这些 WCF 服务参考文件是什么
当我在 Visual Studio 2008 中添加 WCF 服务引用时,会创建一个名为 Service Reference\ServiceReferenceNamespace 的目录。
在此目录中,有名为 Service.xsd、Service1.xsd、Service2.xsd、Service3.xsd 和 Service4.xsd 的文件。这些文件不重复 - 不同的文件定义不同的类型和元素。当我第一次创建服务引用时,只有一个文件,但当我添加更多 DataContract 和 OperationContracts 时,会添加更多 Service* 文件。
看起来有点奇怪,生成了 5 个不同的文件,而不只是一个。如果我删除服务引用(以及目录)然后再次添加它,则会再次添加相同的文件。
谁能解释一下为什么会创建多个文件而不是一个?
When I add a WCF service reference in Visual Studio 2008, a directory named Service Reference\ServiceReferenceNamespace is created.
In this directory, there's files named Service.xsd, Service1.xsd, Service2.xsd, Service3.xsd and Service4.xsd. The files are not duplicates - the different files defines different types and elements. When I first created the service refernece, there was just one file but more Service*-files have been added when I've added more DataContract and OperationContracts.
It looks a bit strange that 5 different files are generated and not just one. If I delete the service reference (and hence the directory) and then add it again, the same files are added again.
Can anyone explain why several files are created and not just one?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您添加服务引用时,VS 首先下载描述服务的元数据(如 WSDL 和 XSD 文件)。它们存储在 ServiceReference 目录中。然后 VS 使用这些文件作为输入运行代码生成步骤,生成 Reference.cs 或 .vb 作为输出。
When you do Add Service Reference, VS first downloads the metadata -- as WSDL and XSD files -- that describes the service. These get stored in the ServiceReference directory. Then VS runs a code generation step using those files as input, producing the Reference.cs or .vb as output.