WCF ServiceHost.Close时间较长问题

在测试WCF例子时,调佣ServiceHost.Close,时间较长,而且在app.config中 CloseTimeout设置似乎与关闭时间长短没有关系,

后发现,在ServiceHost 创建后就设置ClosTimeout的值,能缩短关闭时间。

host1 = new ServiceHost(typeof(Service1));
host1.CloseTimeout = DateTime.Now.AddMilliseconds(1000) - DateTime.Now;    //关闭时间设为1S

原文地址:https://www.cnblogs.com/xihong2014/p/14814243.html