我正在尝试将一些信息从WCF服务推送到控制台应用程序,并偶然发现this guide。
在尝试自己完成后几次失败后,我开始“一步一步”地跟着它,但每次我得到一个AddressAlreadyInUseException
,所以我尝试插入一个clientBaseAddress
然后我得到TimeoutException
。
发布我认为有兴趣的内容。
服务上的绑定和端点
<system.serviceModel>
<bindings>
<wsDualHttpBinding>
<binding name="dualsec">
<security mode="None">
<message clientCredentialType="None"/>
</security>
</binding>
</wsDualHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="svcbh">
<serviceMetadata httpGetEnabled="false"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="Service.Service1" behaviorConfiguration="svcbh">
<host>
<baseAddresses>
<add baseAddress="MyAddress"/>
</baseAddresses>
</host>
<endpoint name ="duplexendpoint"
bindingConfiguration="dualsec"
address =""
binding ="wsDualHttpBinding"
contract ="Service.ICallback"
/>
<endpoint name ="MetaDataTcpEndpoint"
address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange"/>
</service>
</services>
客户端的绑定和端点
<system.serviceModel>
<bindings>
<wsDualHttpBinding>
<binding name="duplexendpoint1" clientBaseAddress="http://localhost:5001" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false"
transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text"
textEncoding="utf-8" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" />
<security mode="Message">
<message clientCredentialType="None" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
</wsDualHttpBinding>
</bindings>
<client>
<endpoint address="MyAddress/Service1.svc" binding="wsDualHttpBinding"
bindingConfiguration="duplexendpoint1" contract="ServiceReference1.ICallback"
name="duplexendpoint">
<identity>
<servicePrincipalName value="host/Balder" />
</identity>
</endpoint>
</client>