-2

如何在我的 WebConfig 文件中更改 Linq 的 TimeOut?

有可能吗?

在代码隐藏中我可以写:

db.CommandTimeout = 3600;

这可以基于 WebConfig 条目来完成吗?

4

1 回答 1

2
  1. Right Click your Project and go to Properties
  2. On left hand side click Settings
  3. Click the link to create a settings file
  4. In The Name Type DBTimeout
  5. In the Type set to int
  6. In the Scope set to Application
  7. In the value set to 3600 (or any other value)

Save this and then go to your code behind and add the following:

db.CommandTimeout = Properties.Settings.Default.DBTimeOut;

This will then allow you to edit the DBTimeout Value via the Web.config typically at the bottom under Application Settings. This should get you what you want. Let me know if you need any more help

于 2013-05-24T19:05:23.420 回答