元数据交换问题 - 方法数量有限制吗?
我有一个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我敢打赌,添加的方法会使消息大小大于默认的最大值。您是否有内部异常,提示“已超出传入消息的最大消息大小配额 (65536)”?
如果是这样,请增加 mex 绑定的 MaxReceivedMessageSize:
请注意,端点绑定不是标准的“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:
Note that the endpoint binding is not standard "mexHttpBinding". I'm copying from a complete example posted on http://www.dasblonde.net.