这些 WCF 服务参考文件是什么

发布于 2024-08-12 01:44:04 字数 400 浏览 3 评论 0原文

当我在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夏至、离别 2024-08-19 01:44:04

当您添加服务引用时,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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文