簡體   English   中英

WCF在.net 4.0上使用basicHttpBinding / customBinding

[英]WCF using basicHttpBinding /customBinding on .net 4.0

我嘗試連接到另一個WCF服務器使用代理,該代理在我的.net 4.0上使用basicHttpBinding / customBinding進行綁定,但是不起作用: '/'應用程序中的服務器錯誤我的web.config文件:

<configuration>
    <system.web>
      <compilation debug="true" targetFramework="4.0" />
    </system.web>

    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="ServicesSoap">
                    <security mode="Transport" />
                </binding>
                <binding name="ServicesSoap1" />
            </basicHttpBinding>
            <customBinding>
                <binding name="ServicesSoap12">
                    <textMessageEncoding messageVersion="Soap12" />
                    <httpsTransport />
                </binding>
            </customBinding>
        </bindings>
        <client>
            <endpoint address="https://Test.com/LineTest/services.asmx"
                binding="basicHttpBinding" bindingConfiguration="ServicesSoap"
                contract="Test.ServicesSoap" name="ServicesSoap" />
            <endpoint address="https://Test.com//LineTest/services.asmx"
                binding="customBinding" bindingConfiguration="ServicesSoap12"
                contract="Test.ServicesSoap" name="ServicesSoap12" />
        </client>
        <behaviors>
            <serviceBehaviors>
                <behavior name="">
                    <serviceMetadata httpGetEnabled="true"  httpGetBinding="true"/>
                    <serviceDebug includeExceptionDetailInFaults="false" />
                </behavior>
            </serviceBehaviors>
          <endpointBehaviors>
            <behavior name="restBehavior">
              <webHttp helpEnabled="true" />
            </behavior>
          </endpointBehaviors>
        </behaviors>
        <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" />
      <services>
        <service name="WCFServerForMobile.WCFServerForAlineTest">
          <endpoint name="ServerForAlineTest" contract="WCFServerForMobile.WCFServerForAlineTest" binding="wsHttpBinding" address="AlineTest" behaviorConfiguration="restBehavior"></endpoint>
        </service>
      </services>
    </system.serviceModel>
</configuration>

`

有什么辦法解決這個問題

httpGetBinding不接受布爾值,而是Binding 您應該改寫您的綁定名稱。

代替:

<serviceMetadata httpGetEnabled="true"  httpGetBinding="true"/>

采用:

<serviceMetadata httpGetEnabled="true"  httpGetBinding="basicHttpBinding"/>

暫無
暫無

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

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