有没有办法增加 Dynamics CRM 服务器调用的超时值?
我正在编写一个简单的应用程序来测试 CRMSDK 提供的 Linq 查询功能。
我的代码很简单。
var before = DateTime.Now;
var crm = new Stub.Xrm.MyDataContext("MyCRM");
var contact = crm.contacts.FirstOrDefault();
var span = new TimeSpan(DateTime.Now.Ticks-before.Ticks);
Console.WriteLine("The name is " + contact.name);
Console.WriteLine("It took " + span.Seconds + " seconds to run this program " );
运行大约需要一分钟,但它有效。 然后我尝试查询不同的实体,例如帐户,我怀疑
Unhandled Exception: System.Net.WebException: The operation has timed out
会发生这种情况,因为我的帐户比联系人更多,因此处理帐户查询需要更长的时间。我试图增加 app.config 的超时值,但没有成功。
I am write a simple application to test the Linq query functionality provided by CRMSDK.
My code is simple enough.
var before = DateTime.Now;
var crm = new Stub.Xrm.MyDataContext("MyCRM");
var contact = crm.contacts.FirstOrDefault();
var span = new TimeSpan(DateTime.Now.Ticks-before.Ticks);
Console.WriteLine("The name is " + contact.name);
Console.WriteLine("It took " + span.Seconds + " seconds to run this program " );
It took about one minute to run but it worked.
Then I try to query different entity such as account, I got the
Unhandled Exception: System.Net.WebException: The operation has timed out
I am suspecting this happens because I had more accounts then contacts, so it took longer to process account query. I am trying to increase the timeout value at my app.config by but didn't work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您的应用程序中不会发生超时。超时发生在服务器端。因此您可以在那里增加它。
是否有特殊原因导致您一次加载所有记录并仅序列中的第一个记录?
您永远不应该收到带有 无限的结果集。
如果您的系统中有 500k 个帐户,则查询将返回所有帐户(包括所有填充的属性)。
The timeout does not happen in your application. The timeout happens on the server side. Therefore you could increase it there.
Is there a special reason why you would load all records at once and take only the first of the sequence?
You should never have a request with an unbounded result set.
If you have 500k accounts in your system, the query will return all of them (including all their filled properties).
您可以在 CRM 的 web.config 中增加超时值。
You can increase the timeout values in the web.config of CRM.
要增加 CRM 超时,您可以使用两种方法:
查看此“将大型自定义文件导入 Microsoft Dynamics CRM 时发生超时”
客户端
如果使用服务代理作为连接场景,可以设置Timeout属性。这是示例:
_serviceProxy.EnableProxyTypes();
var 超时 = new TimeSpan(0, 10, 0); // 添加 10 分钟
_serviceProxy.Timeout = 超时;
希望这有帮助。
To increase CRM timeout, you can use two approaches:
Check out this 'A time-out occurs when you import large customization files into Microsoft Dynamics CRM'
Client side
if you use service proxy as the connection scenario, you can set the Timeout property. Here is the sample:
_serviceProxy.EnableProxyTypes();
var timeout = new TimeSpan(0, 10, 0); // add 10 minutes
_serviceProxy.Timeout = timeout;
Hope this help.