简体   繁体   English

EF 6-错误时间过长

[英]EF 6 - Error taking too long

When using the following connection string 使用以下连接字符串时
Server=DoesNotExists; Database=DoesNotExistsEither; User ID=bla; Password=bla; Connection Timeout=5;
shouldn't any command against this connection string fail in 5 seconds?!? 对这个连接字符串的任何命令都不应该在5秒内失败吗?! in my local machine it's taking about 30sec 在我的本地计算机上大约需要30秒

Edit1 编辑1
If i change the timeout to 20, it takes 1 min to fail... 如果我将超时更改为20,则需要1分钟才能失败...

Command timeout and connection timeout are not the same thing. 命令超时和连接超时不是同一回事。

  • Connection timeout: maximum time to (try to) establish connection to database 连接超时:(尝试)建立与数据库的连接的最大时间
  • Command timeout: maximum time a command is allowed to run 命令超时:允许命令运行的最长时间

So in short: no, a command against that connectionstring should not fail after 5 seconds, if a connection is established. 简而言之:不,如果建立了连接,则针对该连接字符串的命令不应在5秒后失败。

See also this post. 另请参阅这篇文章。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM