添加客户端端点后,WCF地址已在使用中

时间:2012-10-11 20:05:10

标签: wcf exception configuration wcf-binding

我有一个自托管的WCF服务,并通过其他服务启动。在visual studio中进行调试,它们可以正常工作,直到我将端点配置添加到服务客户端的app.config。此服务的某些客户端将是本地服我试过只有命名管道的客户端端点,如果有一个指向服务的客户端端点,以及一个使用端点的客户端(即使它甚至不应该在服务尝试启动时实例化)我得到一个例外告诉我0.0.0.0:8524正在使用中。以下是相关配置:

<service name="EventService.EventPublishingService">
        <clear />
        <endpoint binding="netTcpBinding" address="net.tcp://localhost:8524/EventPublishingService" contract="EventService.Contracts.IEventPublishService">
        </endpoint>
        <endpoint address="net.tcp://localhost:8524/EventPublishingService/mex" binding="mexTcpBinding" contract="IMetadataExchange">
        </endpoint>
        <endpoint address="net.pipe://localhost/EventPublishingServicePipe"
           binding="netNamedPipeBinding" contract="EventService.Contracts.IEventPublishService"
           listenUriMode="Explicit">
        </endpoint>
        <host>
        </host>
     </service>

对于客户端端点我已经尝试了两种

<endpoint address="net.tcp://localhost:8524/EventPublishingService"
            binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IEventPublishService"
            contract="AGX.Atlas.EventService.Contracts.IEventPublishService" name="NetTcpBinding_IEventPublishService">
         </endpoint>

<endpoint address="net.pipe://localhost/EventPublishingServicePipe"
        binding="netNamedPipeBinding" bindingConfiguration="NetNamedPipeBinding_IEventPublishService"
        contract="AGX.Atlas.EventService.Contracts.IEventPublishService" name="NetNamedPipeBinding_IEventPublishService">
     </endpoint>

我在删除客户端绑定时也从服务中删除了net.pipe绑定,以确保它没有做一些奇怪的事情。仍然是同一个问题。

这是绑定配置:

 <netNamedPipeBinding>
        <binding name="NetNamedPipeBinding_IEventPublishService" closeTimeout="00:01:00"
           openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
           transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
           hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288"
           maxBufferSize="65536" maxConnections="10" maxReceivedMessageSize="65536">
           <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
              maxBytesPerRead="4096" maxNameTableCharCount="16384" />
           <security mode="Transport">
              <transport protectionLevel="EncryptAndSign" />
           </security>
        </binding>
     </netNamedPipeBinding>
     <netTcpBinding>
        <binding name="NetTcpBinding_IEventPublishService" closeTimeout="00:01:00"
           openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
           transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
           hostNameComparisonMode="StrongWildcard" listenBacklog="10"
           maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10"
           maxReceivedMessageSize="65536">
           <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
              maxBytesPerRead="4096" maxNameTableCharCount="16384" />
           <reliableSession ordered="true" inactivityTimeout="00:10:00"
              enabled="false" />
           <security mode="Transport">
              <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
              <message clientCredentialType="Windows" />
           </security>
        </binding>
        <binding name="NetTcpBinding_IEventSubscriptionService" closeTimeout="00:01:00"
           openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
           transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
           hostNameComparisonMode="StrongWildcard" listenBacklog="10"
           maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10"
           maxReceivedMessageSize="65536">
           <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
              maxBytesPerRead="4096" maxNameTableCharCount="16384" />
           <reliableSession ordered="true" inactivityTimeout="00:10:00"
              enabled="false" />
           <security mode="Transport">
              <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
              <message clientCredentialType="Windows" />
           </security>
        </binding>
     </netTcpBinding>

0 个答案:

没有答案