- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在开发一个包含 WCF 服务和使用该服务的客户端的解决方案。有时我正在调试服务,有时是客户端,有时两者都是。
在调试期间,我得到一个带有附加信息的 TimeoutException
附加信息:请求 channel 在 00:00:59.9950000 后等待回复时超时。增加传递给 Request 调用的超时值或增加 Binding 上的 SendTimeout 值。分配给此操作的时间可能是较长超时的一部分。
当然是因为我的服务器在断点处等待而不是回答问题。
在调试期间,我想要更长的超时时间,最好不要为我的服务客户端创建新的配置,因为如果此配置的其他值发生变化,则更改者必须记住已创建用于调试的特殊配置。
我觉得是这样的:
private IMyServiceInterface CreateServiceChannel()
{
var myServiceClient = new MyServiceClient(); // reads from configuration file
if (Debugger.IsAttached)
{
// Increase timeouts to enable slow debugging
...
}
return (IMyServiceInterface)myServiceClient;
}
根据 MSDN Binding.SendTimeout Property用于其他用途:
SendTimeout gets or sets the interval of time provided for a write operation to complete before the transport raises an exception.
因此,如果不需要,我宁愿不更改此值。
最佳答案
文章All WCF timouts explained指出确实存在类似事务超时的情况:IContextChannel.OperationTimeout
The operation timeout covers the whole service call (sending the request, processing it and receiving a reply). In other words, it defines the maximum time a service call is active from a client’s point of view. If not set, WCF initializes the operation timeout with the configured send timeout.
这解释了为什么抛出的 TimeoutException 建议更改发送超时。
但是,可以在不更改发送超时的情况下更改操作超时:
var myServiceClient = new MyServiceClient(); // reads from configuration file
if (Debugger.IsAttached)
{ // Increase timeouts to enable slow debugging:
IContextChannel contextChannel = (IContextChannel)myServiceClient.InnerChannel;
// InnerChannel is of type IClientChannel, which implements IContextChannel
// set the operation timeout to a long value, for example 3 minutes:
contextChannel.OperationTimeout = TimeSpan.FromMinutes(3);
}
return (IMyInterface)myService;
关于c# - ClientBase 端点绑定(bind) SendTimeout ReceiveTimeout : how to change while debugging,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40549144/
我正在尝试将超时/EndPointNotFound 异常时间减少到 10 秒。异常日志表明调用在 10 秒内超时,但如果我使用 StopWatch 添加代码,则大约需要 21 - 22 秒。 我在 t
我有一个使用 WCF 让两个应用程序相互通信的小型基本工作示例。我的客户端应用程序监听服务器,在配置我的设置的 app.config 文件中有 XML。在编译时硬编码的一项设置是隐藏在 basicHt
我随机遇到了这个问题,我能够使用 WCFServiceClient 添加/删除/更新,然后我得到错误并且它随机发生...... 下面是我正在使用的客户端代码... using(WCFServiceCl
看着我的 app.config 有点困惑,它看起来像这样:
经过相当多的搜索,我找不到这个问题的答案。 OperationTimeout 之间的确切区别是什么?和 SendTimeout ?我读到 OperationTimeout 是 SendTimeout
我的主机中有以下 app.config: 如何将
我正在开发一个包含 WCF 服务和使用该服务的客户端的解决方案。有时我正在调试服务,有时是客户端,有时两者都是。 在调试期间,我得到一个带有附加信息的 TimeoutException 附加信息:请求
我是一名优秀的程序员,十分优秀!