没有与Message MessageVersion绑定

时间:2014-08-12 08:38:40

标签: asp.net wcf web-config

<system.serviceModel>    
<client>      
  <endpoint address=".../ConnectService.svc"
            binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IConnectService"
  contract="TestApp.Services.IConnectService" name="BasicHttpBinding_IConnectService" />
</client>

<behaviors>
  <serviceBehaviors>

    <behavior name="ConnectServiceBehavior">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>

    <behavior name="">
      <serviceMetadata httpGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>

  </serviceBehaviors>

<endpointBehaviors>
  <behavior name="ConnectEndPointBehavior">
      <enableWebScript />
  </behavior>
</endpointBehaviors>
</behaviors>

<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>

<services>     

  <service behaviorConfiguration="ConnectServiceBehavior" name="TestApp.Services.ConnectService">
    <endpoint address="" binding="basicHttpBinding" contract="TestApp.Services.IConnectService" behaviorConfiguration="ConnectEndPointBehavior"/>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>

</services>

 </system.serviceModel>

我正在

The endpoint at '.../ConnectService.svc' does not have a Binding with the None MessageVersion.  'System.ServiceModel.Description.WebScriptEnablingBehavior' is only intended for use with WebHttpBinding or similar bindings.

服务器错误。 有什么建议吗?

1 个答案:

答案 0 :(得分:1)

这里我正在使用&#34; enableWebScript&#34;在endpointBehaviors(REST)&amp;在服务端点basicHttpBinding(SOAP)中。因此我得到了这个例外。所以正确的方法是

<services>     

<service behaviorConfiguration="ConnectServiceBehavior"  name="TestApp.Services.ConnectService">
<endpoint address="" binding="webHttpBinding" contract="TestApp.Services.IConnectService" behaviorConfiguration="ConnectEndPointBehavior"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>

   </services>