解决 WCF 错误:此服务的元数据发布当前已禁用
我想发布具有自定义绑定配置的 Web 服务。我使用自定义绑定配置来增加 65536 字节的默认消息大小。我遇到的问题是,当我使用如下所示的 web.config 设置时,出现错误:
此服务的元数据发布当前已禁用。
我的主要目标是能够增加默认消息大小,因此欢迎任何其他配置,但是我试图使其尽可能简单以避免进一步的问题。
您能发现我的配置有什么问题吗?
<bindings>
<basicHttpBinding>
<binding name="NewBinding0" closeTimeout="00:10:00" openTimeout="01:10:00"
receiveTimeout="01:10:00" sendTimeout="01:10:00" maxBufferSize="99536"
maxBufferPoolSize="5242880" maxReceivedMessageSize="99536">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="99536" maxBytesPerRead="99536" maxNameTableCharCount="2147483647" />
<security>
<transport clientCredentialType="Basic" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="MeterReadingOrderWSBehaviors">
<serviceMetadata httpsGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="MeterReadingOrderWS.IMeterReadingOrderWS" behaviorConfiguration="MeterReadingOrderWSBehaviors">
<host>
<baseAddresses>
<add baseAddress="http://localhost:3440/MeterReadingOrderWS.svc"/>
</baseAddresses>
</host>
<endpoint address="" contract="MeterReadingOrderWS.IMeterReadingOrderWS" binding="basicHttpBinding" bindingConfiguration="NewBinding0" />
<endpoint address="mex" contract="IMetadataExchange" binding="mexHttpsBinding" />
</service>
</services>
I want to publish a Webservice with custom binding configuration. I am using a custom binding configuration to increase the default message size of 65536 bytes. The problem I am having is that when I use the web.config settings as shown below, I am getting an error:
Metadata publishing for this service is currently disabled.
My Main goal is to be able to increase the default message size, therefore any other config is welcome, however I was trying to keep it as simple as possible to avoid further issues.
Can you please spot what is wrong with my configuration?
<bindings>
<basicHttpBinding>
<binding name="NewBinding0" closeTimeout="00:10:00" openTimeout="01:10:00"
receiveTimeout="01:10:00" sendTimeout="01:10:00" maxBufferSize="99536"
maxBufferPoolSize="5242880" maxReceivedMessageSize="99536">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="99536" maxBytesPerRead="99536" maxNameTableCharCount="2147483647" />
<security>
<transport clientCredentialType="Basic" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="MeterReadingOrderWSBehaviors">
<serviceMetadata httpsGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="MeterReadingOrderWS.IMeterReadingOrderWS" behaviorConfiguration="MeterReadingOrderWSBehaviors">
<host>
<baseAddresses>
<add baseAddress="http://localhost:3440/MeterReadingOrderWS.svc"/>
</baseAddresses>
</host>
<endpoint address="" contract="MeterReadingOrderWS.IMeterReadingOrderWS" binding="basicHttpBinding" bindingConfiguration="NewBinding0" />
<endpoint address="mex" contract="IMetadataExchange" binding="mexHttpsBinding" />
</service>
</services>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我继续我的研究并遵循这篇文章解决了我的问题:
http://keithelder.net/2008/01/17/exusing-a-wcf-service-with-multiple-bindings-and-endpoints/
希望它可以帮助其他人 出色地。
I have continued my research and followed this article which solved my problem:
http://keithelder.net/2008/01/17/exposing-a-wcf-service-with-multiple-bindings-and-endpoints/
Hope it can help others as well.
请注意,您的问题似乎与元数据行为有关,在此之前您必须检查服务名称
下面代码中的 ieWebApplication1.MyService ;
这应该是相同的顺序namespace.service
Note that your problem is seems to be related with Metadata behaviour, before that you have to check name of service
i.e.WebApplication1.MyService in below code;
this should be in same order namespace.service
为您的服务添加行为并启用
像这样:
Add behavior for your Service and enable
like this:
您已通过 https 启用元数据服务,但您有一个用于 mexHttpsBinding 的 http 端点。
您必须使用 https 作为端点地址。
编辑
您使用 mexHttpsBinding,因此使用 httpsGetEnabled 是正确的。如果您不想使用 https 作为元数据,请使用 httpGetEnabled 并将 mex 的绑定类型从 mexHttpsBinding 更改为 mexHttpBinding。
如果您想使用 https 来获取元数据,请考虑对每个 mex 端点使用完整的地址表示法
You've enabled metadata service through https but you have a http endpoin for mexHttpsBinding.
You have to use https for you endpoint address.
Edit
You use mexHttpsBinding so it's correct to use httpsGetEnabled. If you don't want https for metadata use httpGetEnabled and change binding type for mex from mexHttpsBinding to mexHttpBinding.
If you want to use https for metadata consider to use a full address notation per your mex endpoint