remoting延时问题
本人正在开发一个项目,服务器端和客户端都是通过config进行连接的。程序测试能够正常进行,但是有一个问题就是当客户端超过180秒不动窗口的时候,任何按钮都不会起作用,但是把窗口关闭再重新打开,按钮又会起作用了。不知道是什么原因,在网上查了很多资料,都说是延时,但是又不知道怎么改法,在哪里改。请各位高手帮帮!(c# C/S三层结构)
1、服务器端的app.config配置
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings >
<add key="Dal" value="DAL"/>
<add key="connentStr" value="server=192.168.1.100;database=yy;uid=yy;pwd=yy;"/>
</appSettings>
<system.runtime.remoting >
<application name="RemoteHostService">
<service>
<wellknown type="BLLFactory.BLLbuild,BLLFactory" objectUri="BLLbuild" mode="Singleton" />
</service>
<channels>
<channel ref="tcp" port="8080" />
</channels>
</application>
</system.runtime.remoting>
</configuration>
服务器窗体load代码:
RemotingConfiguration.Configure("Server.exe.config", false);//配置信道
2、客户端的app.config配置
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings >
<add key ="ServiceURL" value ="tcp://127.0.0.1:8080/BLLbuild"/>
<add key ="conStr" value="Server=192.168.1.100;Initial Catalog=xx;User ID=sa;Password=xx;"/>
<add key="hoscode" value="32"/>
</appSettings>
</configuration>
客户端窗体load代码:
//注册TCP通道,用于连接自己或者他人的服务器。
TcpChannel chan1 = new TcpChannel();
ChannelServices.RegisterChannel(chan1, false);
//获得服务器远程对象的本地代理(从这里可以知道连接服务器是否成功与否)
myBllBuild = (IBLL.IBLLbuild)Activator.GetObject(typeof(IBLL.IBLLbuild), System.Configuration.ConfigurationManager.AppSettings["ServiceURL"]);
func = (IBLL.IFunction)myBllBuild.CreateFunction();