WCF wsDualHttpBinding 双工通信 寄宿服务器的IIS , 客户端使用的时候总是超时。

linzhuohao213 2014-09-10 11:23:09
服务器端:
[ServiceContract(SessionMode=SessionMode.Required ,CallbackContract=typeof(IEHAOYAOCallback))]
public interface IEHAOYAOMessageService
{
[OperationContract(IsOneWay = false, IsInitiating = true, IsTerminating = false)]
string Join(string agentId);
[OperationContract(IsOneWay = true, IsInitiating = false, IsTerminating = false)]
void Leave();
[OperationContract(IsOneWay = false,IsInitiating = false, IsTerminating = false)]
string ClearWait();
[OperationContract(IsOneWay = false, IsInitiating = false, IsTerminating = false)]
string CloseSeesion(string customerOpenID);
[OperationContract(IsOneWay = true, IsInitiating = false, IsTerminating = false)]
void GetWaitCustomer();
[OperationContract(IsOneWay = false, IsInitiating = false, IsTerminating = false)]
string UpdateStatus(int status);


}

public interface IEHAOYAOCallback
{
[OperationContract(IsOneWay = true)]
void ReceiveTextMessage(TextEntity messageEntity);
[OperationContract(IsOneWay=true)]
void ReceiveImageMessage(ImageEntity messageEntity);
[OperationContract(IsOneWay = true)]
void ReceiveVoiceMessage(VoiceEntity messageEntity);
}


服务器端配置文件:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/></system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<!--为避免泄漏元数据信息,请在部署前将以下值设置为 false 并删除上面的元数据终结点-->
<serviceMetadata httpGetEnabled="true"/>
<!--要接收故障异常详细信息以进行调试,请将以下值设置为 true。在部署前设置为 false 以避免泄漏异常信息-->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="WCFService.EHAOYAOMessageService">
<endpoint address="" binding="wsDualHttpBinding" bindingConfiguration="myBindingNone" contract="WCFService.IEHAOYAOMessageService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<bindings>
<wsDualHttpBinding>
<binding name="myBindingNone" sendTimeout="00:04:00">
<security mode="None">
</security>
</binding>
</wsDualHttpBinding>
</bindings>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>

客户端:

private void Form1_Load(object sender, EventArgs e)
{
client = new EHAOYAOMessageServiceClient(new System.ServiceModel.InstanceContext(this));
}

private void button2_Click(object sender, EventArgs e)
{
MessageBox.Show(client.Join(txtAgent.Text));
}
...全文
93 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
linzhuohao213 2014-09-10
  • 打赏
  • 举报
回复
客户端的配置文件:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <configSections>
    </configSections>
    <system.serviceModel>
        
        <bindings>
            <wsDualHttpBinding>
                <binding name="WSDualHttpBinding_IEHAOYAOMessageService">
                    <security mode="None" />
                </binding>
            </wsDualHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://10.166.253.20:207/EHAOYAOMessageService.svc"
                binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_IEHAOYAOMessageService"
                contract="ServiceReference1.IEHAOYAOMessageService" name="WSDualHttpBinding_IEHAOYAOMessageService" />
        </client>
    </system.serviceModel>
</configuration>
linzhuohao213 2014-09-10
  • 打赏
  • 举报
回复
但是我关闭了客户端机子的防火墙就能正常访问了

12,162

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 Web Services
社区管理员
  • Web Services社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧