簡體   English   中英

system.serviceModel / bindings / wsHttpBinding處的綁定沒有……錯誤

[英]The binding at system.serviceModel/bindings/wsHttpBinding does not have… error

我正在嘗試在基於WCF Web的服務中包括兩個終結點-wsHttp和netTcp。 如下面的Web.config所示,我已經添加了它們,但是在編譯並在Web瀏覽器中單擊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>

取出這個:

          bindingConfiguration="wsHttpBinding"

從這里:

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

我認為您已經正確地回答了這個問題,我確定他想實現一種綁定配置,因此不必刪除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">

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM