【问题标题】:The binding at system.serviceModel/bindings/wsHttpBinding does not have... errorsystem.serviceModel/bindings/wsHttpBinding 处的绑定没有...错误
【发布时间】:2018-09-29 01:19:55
【问题描述】:

我正在尝试在基于 Web 的 WCF 服务中包含两个端点 - wsHttp 和 netTcp。 如下面的Web.config 所示,我已经添加了它们,但是当我在我的网络浏览器中编译并单击 Service.svc 时收到以下错误:

错误页面:

Server Error in '/MyService' Application. Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: The binding at system.serviceModel/bindings/wsHttpBinding does not have a configured binding named 'wsHttpBinding'. This is an invalid value for bindingConfiguration.

Source Error:

Line 16: </baseAddresses> Line 17:         </host>  Line 18:  <endpoint address="http://localhost:8090/Services/MyService" Line 19:                   binding="wsHttpBinding" Line 20:                 bindingConfiguration="wsHttpBinding"


Source File: C:\MyService\web.config    Line: 18

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

Web.config:

<?xml version="1.0"?>
<configuration>
  <system.web>
    <compilation debug="false" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>
    <protocolMapping>
      <add scheme="http" binding="wsHttpBinding"/>
    </protocolMapping>
    <services>
      <service
        name="Microsoft.ServiceModel.Samples.MyService">
        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://localhost:9001/"/>
          </baseAddresses>
        </host>
        <endpoint address="http://localhost:8090/Services/MyService"
                  binding="wsHttpBinding"
                  bindingConfiguration="wsHttpBinding"
                  name="MyService_WsHttp"
                  contract="Microsoft.ServiceModel.Samples.IService" />
        <endpoint address="net.tcp://localhost:9000/Services/MyService"
                  binding="netTcpBinding"
                  bindingConfiguration="tcpBinding"
                  name="MyService_Tcp"
                  contract="Microsoft.ServiceModel.Samples.IService" />    
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- 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="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>

</configuration>

【问题讨论】:

    标签: c# wcf


    【解决方案1】:

    把这个拿出来:

              bindingConfiguration="wsHttpBinding"
    

    从这里开始:

    address="http://localhost:8090/Services/MyService" 
                      binding="wsHttpBinding" 
                      bindingConfiguration="wsHttpBinding" 
    

    【讨论】:

    • 如果有效,请标记为答案 - 原因是如果您使用“开箱即用”绑定(就像您一样......),那么您还没有进行任何配置更改- 该属性是用来表示的。
    • 当我使用wsHttpBinding时,它说合约必须使用DualHttpBinding?!
    • @Hari 你在开发双工服务吗?
    • 抱歉回复晚了。是的,克里斯
    • 你需要使用 wsDualHttpBinding (如果我没记错的话!)然后。发布一个 Q 并包含您的配置。
    【解决方案2】:

    我不认为你已经正确回答了我确定他想要实施的问题 绑定配置,因此不要删除bindingConfiguration="wsHttpBinding,只需确保您的和点中的绑定与配置文件中的绑定匹配。 希望这会奏效

    例如:

    <bindings>
          <netTcpBinding>
            <!--Configure the Service operation instance object timeout of an endpoint -->
            <binding name="netTCP" receiveTimeout="00:00:10" />
          </netTcpBinding>
        </bindings>
    
    <endpoint address="PerSessionService" binding="netTcpBinding" contract="InstanceContext_PerSessionService.IPerSessionService" bindingConfiguration="netTCP">
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-08-16
      • 2013-09-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-05-30
      • 2011-05-11
      • 2012-11-19
      相关资源
      最近更新 更多