ASMX Web 服务公开类

发布于 2024-07-14 13:15:41 字数 345 浏览 2 评论 0原文

我正在使用简单的 ASMX 服务在 asp.net/c# 中创建基本的 Web 服务。 当我创建返回类的方法时,服务的客户端可以发现该类定义。

我想知道是否有一种方法可以将类公开给不直接在任何服务方法中使用的服务。 我需要我的服务客户端了解特定的类,即使它没有在任何方法中显示为返回值或参数类型。

我意识到这是一个奇怪的要求,但它的出现是因为我们正在序列化对象并压缩序列化文件。 我们最终将对象作为 byte[] 发送。 当在另一端反序列化它时,这会导致问题,因为客户端不知道该类。

有没有一种方法可以装饰一个类,以便可以通过服务发现来发现它?

提前致谢,

马丁。

I'm creating a basic web service in asp.net/c# using simple ASMX services. When I create a method that returns a class, this class definition is discoverable by clients of the service.

I'm wondering if there is a way to expose a class to the service that isn't used directly in any of the service methods. I need my service clients to know about a particular class even though it doesn't appear as a return value or parameter type in any of the methods.

I realise this is a strange requirement, but it comes about because we're serialising the object and compressing the serialised file. We send the object as a byte[] ultimately. This is causing an issue when it comes to deserialising it on the other end as the client doesn't know about the class.

Is there a way to decorate a class so that it's discoverable through service discovery?

Thanks in advance,

Martin.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

只为守护你 2024-07-21 13:15:41

在公开的类上使用 XmlInclude 属性包括另一个。

Use the XmlInclude attribute on an exposed class to include another one.

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