服务器端配置
<configuration>
<appSettings>
<add key="RandomDataPointFrequencyInMilliseconds" value="100"/>
</appSettings>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="MyServiceTypeBehaviors" >
<!-- 将下列元素添加到服务行为配置中。 -->
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<wsDualHttpBinding>
<binding name="httpconf">
<security mode="None">
<message clientCredentialType="None" negotiateServiceCredential="false"/>
</security>
</binding>
</wsDualHttpBinding>
</bindings>
<services>
<service name="PublicationSubscription.PublisherService" behaviorConfiguration="MyServiceTypeBehaviors">
<host>
<baseAddresses>
<add baseAddress="http://localhost:9000/Server/"/>
</baseAddresses>
</host>
<endpoint
address="Publisher"
binding="wsDualHttpBinding"
contract="PublicationSubscription.IPublisher"
bindingConfiguration="httpconf"
/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
</configuration>
客户端配置
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<client>
<endpoint name="SubscriptionService"
address="http://localhost:9000/Server/Publisher"
binding="wsDualHttpBinding"
bindingConfiguration="SubscriberBindingConfiguration"
contract="PublicationSubscription.IPublisher"
/>
</client>
<bindings>
<wsDualHttpBinding>
<binding name="SubscriberBindingConfiguration"
clientBaseAddress="http://localhost:9001/Subscriber">
<security mode="None">
<message clientCredentialType="None" negotiateServiceCredential="false"/>
</security>
</binding>
</wsDualHttpBinding>
</bindings>
</system.serviceModel>
</configuration>
在本地运行一切正常,但把WCF宿主运行于服务器,客户端在本地打开时就报错,错误内容如下:
message:
"打开操作没有在分配的超时 00:00:59.7031250 内完成。分配给该操作的时间可能是更长超时的一部分。"
StackTrace:
Server stack trace:
在 System.ServiceModel.Channels.ReliableRequestor.ThrowTimeoutException()
在 System.ServiceModel.Channels.ReliableRequestor.Request(TimeSpan timeout)
在 System.ServiceModel.Channels.ClientReliableSession.Open(TimeSpan timeout)
在 System.ServiceModel.Channels.ClientReliableDuplexSessionChannel.OnOpen(TimeSpan timeout)
在 System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
在 System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
在 System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
防火墙?
楼主上面的问题如何解决? 我也郁闷中呀。。。。
换成nettcp试试