Skip to content

Instantly share code, notes, and snippets.

@wilfrem
Created September 8, 2013 05:11
Show Gist options
  • Save wilfrem/6482027 to your computer and use it in GitHub Desktop.
Save wilfrem/6482027 to your computer and use it in GitHub Desktop.
ServiceStack.OrmLite+MySQLのバグ?
多分、どっちが悪いってわけじゃないんだろうけど。。。
ServiceStack.OrmLiteのautoDisposeConnectionをfalseにしてMySQLを使うと1日ぐらいでConnection must be valid and Openっていうエラーが出るようになります
これはどうもMySQLのConnectionはプーリングしてるといつの間にかClose?Dispose?するっぽくて(長時間アクセスなしが入るかも)、それで上記エラーが出るらしい。
回避策としては常にOpenするようにしましょうとここには書いてある
http://bytes.com/topic/asp-net/answers/325128-system-invalidoperationexception-connection-must-valid-open
で、一方、ServiceStackはautoDisposeConnection=falseだと一度Openしたのは二度Openしないってのが入ってるので、いつの間にか死んでる接続につなぎに行ってエラーになる/(^o^)\
多分trueにすると解決しそうなので、これから試す
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment