开发者

Metadata Exchange Problem - Limit on the number of methods?

开发者 https://www.devze.com 2023-04-01 23:25 出处:网络
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:

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="mexHttpBindin开发者_C百科g" 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消