我尝试连接到另一个WCF服务器使用代理,该代理使用basicHttpBinding / customBinding来绑定我的.net 4.0,但它无法正常工作:Server Error in '/' Application 我的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>
`
有没有办法解决这个问题
答案 0 :(得分:0)
httpGetBinding不接受布尔值,但Binding
。你应该改为使用绑定名称。
而不是:
<serviceMetadata httpGetEnabled="true" httpGetBinding="true"/>
使用:
<serviceMetadata httpGetEnabled="true" httpGetBinding="basicHttpBinding"/>