有没有办法增加 Dynamics CRM 服务器调用的超时值?

发布于 2024-11-09 02:50:47 字数 647 浏览 0 评论 0原文

我正在编写一个简单的应用程序来测试 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

冰葑 2024-11-16 02:50:47

您的应用程序中不会发生超时。超时发生在服务器端。因此您可以在那里增加它。

是否有特殊原因导致您一次加载所有记录并序列中的第一个记录?

您永远不应该收到带有 无限的结果集。
如果您的系统中有 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).

毁我热情 2024-11-16 02:50:47

您可以在 CRM 的 web.config 中增加超时值。

You can increase the timeout values in the web.config of CRM.

别靠近我心 2024-11-16 02:50:47

要增加 CRM 超时,您可以使用两种方法:

  1. 服务器端

    查看此“将大型自定义文件导入 Microsoft Dynamics CRM 时发生超时”
  2. 客户端

    如果使用服务代理作为连接场景,可以设置Timeout属性。这是示例:

    _serviceProxy.EnableProxyTypes();
    var 超时 = new TimeSpan(0, 10, 0); // 添加 10 分钟
    _serviceProxy.Timeout = 超时;

    希望这有帮助。

To increase CRM timeout, you can use two approaches:

  1. Server side

    Check out this 'A time-out occurs when you import large customization files into Microsoft Dynamics CRM'
  2. 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文