实体框架-如何手动清除连接池? SNIX_Excecute错误 [英] Entity Framework - How to clear connection pool manually? SNIX_Excecute Error

查看:208
本文介绍了实体框架-如何手动清除连接池? SNIX_Excecute错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为xamarin项目使用实体框架。当该应用在iOS上最小化然后再次打开时,它将引发连接问题(请参见下面的错误):
SNIX_Execute(提供者:SNI_PN7,错误:35-SNI_ERROR_35)

I'm using entity framework for a xamarin project. When the app is minimised on iOS and then opened again it throws connection problems (See error below): SNIX_Execute (provider: SNI_PN7, error: 35 - SNI_ERROR_35)

我发现解决此问题的唯一方法是在连接字符串中将pooling设置为false。

The only way I've found to solve this is to set pooling to false in the connection string.

我想在xamarin的OnSleep()方法中手动清除连接池。

I want to clear the connection pool manually in the OnSleep() method in xamarin. Is there anyway to clear Entity Framework's connection pool?

推荐答案

更新-刚刚找到了解决方法。在简历方法中添加:

Update - Just found out how to do it. On the resume method in add:

SqlConnection.ClearAllPools();

这篇关于实体框架-如何手动清除连接池? SNIX_Excecute错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆