我修改了我的 web.config 以添加自定义绑定以增加缓冲区和消息大小,并且似乎在显式创建服务元素时,它以某种方式破坏了对我的行为元素的引用。
当我尝试使用 WCF 测试客户端从 VS 运行我的 Web 服务时,或者我转到服务页面时,我收到错误消息:
Metadata publishing for this service is currently disabled.
我已经将我的 web.config 与几个不同的来源进行了比较,一切似乎都匹配。我不知道问题是什么。
这是 System.serviceModel 元素:
<system.serviceModel>
<services>
<service name="BIMIntegrationWS.BIMIntegrationService" behaviorConfiguration="metadataBehavior">
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<endpoint address="http://localhost:1895/BIMIntegrationService.svc"
binding="customBinding" bindingConfiguration="customBinding0"
contract="BIMIntegrationWS.IBIMIntegrationService"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="metadataBehavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<customBinding>
<binding name="customBinding0">
<binaryMessageEncoding />
<httpTransport maxReceivedMessageSize="262064"
maxBufferSize="262064"
maxBufferPoolSize="262064" />
</binding>
</customBinding>
</bindings>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true"/>
似乎 Web 服务页面没有找到该元素。我没有收到抱怨目标 behaviorConfiguration 不存在或类似情况的错误,只是未启用元数据发布。
任何帮助将不胜感激。
谢谢。