【发布时间】:2011-06-05 14:24:19
【问题描述】:
我正在尝试创建由 ASP.NET 托管的 wcf 服务(前段时间我做过,但现在不能...)
在这一步我想添加元数据支持。将以下端点添加到配置后:
<endpoint address="mex" behaviorConfiguration="McActivationApp.EnrollmentServiceAspNetAjaxBehavior"
binding="mexHttpBinding" contract="IMetadataExchange" />
我遇到以下错误:
端点在 'http://MyPcName/MCActivation/EnrollmentService.svc/mex' 没有与 None 的绑定 消息版本。 'System.ServiceModel.Description.WebScriptEnablingBehavior' 仅用于与 WebHttpBinding 或类似的绑定。
我尝试将“IMetadataExchange”合同更改为“”。这会导致另一个错误:
端点在 'http://MyPcName/MCActivation/EnrollmentService.svc/mex' 没有与 None 的绑定 消息版本。 'System.ServiceModel.Description.WebScriptEnablingBehavior' 仅用于与 WebHttpBinding 或类似的绑定。
请指教,如何正确添加对元数据的支持?
这是完整的“system.serviceModel”部分。
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="McActivationApp.EnrollmentServiceAspNetAjaxBehavior">
<enableWebScript />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="McActivationApp.EnrollmentServiceAspNetAjaxBehavior">
<serviceMetadata httpGetEnabled="True"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<services>
<service behaviorConfiguration="McActivationApp.EnrollmentServiceAspNetAjaxBehavior"
name="McActivationApp.EnrollmentService">
<endpoint address="" behaviorConfiguration="McActivationApp.EnrollmentServiceAspNetAjaxBehavior"
binding="webHttpBinding" contract="McActivationApp.EnrollmentService" />
<endpoint address="mex" behaviorConfiguration="McActivationApp.EnrollmentServiceAspNetAjaxBehavior"
binding="mexHttpBinding" contract="McActivationApp.EnrollmentService" />
</service>
</services>
</system.serviceModel>
</configuration>
【问题讨论】: