【发布时间】:2010-08-04 14:56:59
【问题描述】:
我修改了我的 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 不存在或类似情况的错误,只是未启用元数据发布。
任何帮助将不胜感激。
谢谢。
【问题讨论】:
-
我已经进行了一些调试,似乎每当我访问 Web 服务页面(在浏览器中)时,它都没有使用定义的
元素。相反,它使用一些默认服务元素,该元素正在寻找默认的 定义(没有名称的定义)。如果我简单地添加这个默认的 元素,与 metaDataBehavior 的定义相同,那么服务就可以工作了。 -
但是,在 WSDL 页面中,
元素不是我的配置中定义的元素。它改为如下所示: localhost:1895/BIMIntegrationService.svc">
标签: web-config wcf metadata wcf-configuration