元数据交换问题 - 方法数量有限制吗?

发布于 2024-12-02 11:49:04 字数 899 浏览 0 评论 0原文

我有一个 WCF 服务,公开了大约 34 个方法。直到今天,使用 MetadataExchangeClient 进行元数据交换工作得很好,但突然我开始遇到以下异常:

元数据包含无法解析的引用:http://localhost:1150/service.svc?wsdl=wsdl0

最“有趣”问题是,如果我注释掉服务契约中的一些方法(无论是哪些),以便服务公开更少方法,我就可以获得正确的元数据。 web.config 设置显示“

<system.serviceModel>
<services>
  <service name="(...)" serviceBehavior="(...)">
  <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
</services>
<behaviors>
    <serviceBehaviors>
        <behavior name="(...)"><serviceMetadata httpGetEnabled="True"></behavior>
    <serviceBehaviors>
</behaviors>

所有名称均受命名空间限定”,并且在公开 15 个方法时一切正常。每当我尝试揭露更多内容时,无论是哪一个,我都会遇到例外。我做错了什么?

I have a WCF service exposing some 34 methods. Up until today metadata exchanging using MetadataExchangeClient was working just fine, but suddenly I started getting the following exception:

Metadata contains a reference that cannot be resolved: http://localhost:1150/service.svc?wsdl=wsdl0

The most "interesting" thing is that if I comment out some of the methods (no matter which ones) in the service contract so that the service exposes less methods I can get metadata just right. The web.config settings reads

<system.serviceModel>
<services>
  <service name="(...)" serviceBehavior="(...)">
  <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
</services>
<behaviors>
    <serviceBehaviors>
        <behavior name="(...)"><serviceMetadata httpGetEnabled="True"></behavior>
    <serviceBehaviors>
</behaviors>

All names are namespace-qualified and everything works well while exposing, say, 15 methods. Whenever I try to expose more, and no matter which ones, I get that exception. What am I doing wrong?

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

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

发布评论

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

评论(1

や三分注定 2024-12-09 11:49:04

我敢打赌,添加的方法会使消息大小大于默认的最大值。您是否有内部异常,提示“已超出传入消息的最大消息大小配额 (65536)”?

如果是这样,请增加 mex 绑定的 MaxReceivedMessageSize:

    <services>
        <service>
            <endpoint contract="IMetadataExchange" binding="wsHttpBinding" bindingConfiguration="mexBinding" address="mex" />
        </service>
    </services>
    <bindings>
        <wsHttpBinding>
            <binding name="mexBinding" maxReceivedMessageSize="5000000">
                <security mode="None"/>
            </binding>
        </wsHttpBinding>
    </bindings>

请注意,端点绑定不是标准的“mexHttpBinding”。我正在复制发布在 http://www.dasblonde.net

I bet the added methods make the message size greater than the default max. Do you have an inner exception saying "The maximum message size quota for incoming messages (65536) has been exceeded"?

If so increase your mex binding's MaxReceivedMessageSize:

    <services>
        <service>
            <endpoint contract="IMetadataExchange" binding="wsHttpBinding" bindingConfiguration="mexBinding" address="mex" />
        </service>
    </services>
    <bindings>
        <wsHttpBinding>
            <binding name="mexBinding" maxReceivedMessageSize="5000000">
                <security mode="None"/>
            </binding>
        </wsHttpBinding>
    </bindings>

Note that the endpoint binding is not standard "mexHttpBinding". I'm copying from a complete example posted on http://www.dasblonde.net.

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