MongoDB的C#驱动报错Server instance 127.0.0.1:27017 is no longer connected的解决方案
使用C#的MondoDB驱动,一直没问题。结果最近,MongoCursor的ToList方法,取列表,总是报错
Server instance 127.0.0.1:27017 is no longer connected
数据什么的也是正常。
最后终于发现导致问题出现的原因。虽然解决方法不是很完美,但是也还解决问题了。
如果有其它好的解决方法的同学可以和我交流,微信:Jeff520888
错误信息如下:
<html>
<head>
<title>Server instance 127.0.0.1:27017 is no longer connected.</title>
<style>
body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;}
p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
pre {font-family:"Lucida Console";font-size: .9em}
.marker {font-weight: bold; color: black;text-decoration: none;}
.version {color: gray;}
.error {margin-bottom: 10px;}
.expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
</style>
</head>
<body bgcolor="white">
<span><H1>“/”应用程序中的服务器错误。<hr width=100% size=1 color=silver></H1>
<h2> <i>Server instance 127.0.0.1:27017 is no longer connected.</i> </h2></span>
<font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">
<b> 说明: </b>执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
<br><br>
<b> 异常详细信息: </b>System.InvalidOperationException: Server instance 127.0.0.1:27017 is no longer connected.<br><br>
<b>源错误:</b> <br><br>
<table width=100% bgcolor="#ffffcc">
<tr>
<td>
<code>
执行当前 Web 请求期间生成了未经处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。</code>
</td>
</tr>
</table>
<br>
<b>堆栈跟踪:</b> <br><br>
<table width=100% bgcolor="#ffffcc">
<tr>
<td>
<code><pre>
[InvalidOperationException: Server instance 127.0.0.1:27017 is no longer connected.]
MongoDB.Driver.MongoServerInstance.AcquireConnection() +140
MongoDB.Driver.MongoServer.AcquireConnection(MongoServerInstance serverInstance) +259
MongoDB.Driver.MongoCursorConnectionProvider.AcquireConnection() +56
MongoDB.Driver.Operations.QueryOperation`1.KillCursor(IConnectionProvider connectionProvider, Int64 cursorId) +44
MongoDB.Driver.Operations.<Execute>d__0.<>m__Finally6() +55
MongoDB.Driver.Operations.<Execute>d__0.System.IDisposable.Dispose() +211
MongoDB.Driver.Operations.<Execute>d__0.MoveNext() +598
System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +406
System.Linq.Enumerable.ToList(IEnumerable`1 source) +58
DAL.MongoHelper`1.Find(String collection, IMongoQuery query, String[] fields, String[] sortBys, Int32 skip, Int32 limit, Int64& totalNum) +934
DAL.Service.CommonService.GetNodePageList(MongoPageCriteria criteria) +146
DAL.Service.AppService.GetOrderListForPage(MongoPageCriteria criteria, Order ord) +5114
Admin.BLL.AppManager.GetOrderListForPage(MongoPageCriteria criteria, Order order) +51
Admin.View.OrderList.BindData() +807
Admin.View.OrderList.OnLoad(EventArgs e) +516
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207
</pre></code>
</td>
</tr>
</table>
<br>
<hr width=100% size=1 color=silver>
<b>版本信息:</b> Microsoft .NET Framework 版本:4.0.30319; ASP.NET 版本:4.0.30319.1016
</font>
</body>
</html>
<!--
[InvalidOperationException]: Server instance 127.0.0.1:27017 is no longer connected.
在 MongoDB.Driver.MongoServerInstance.AcquireConnection()
在 MongoDB.Driver.MongoServer.AcquireConnection(MongoServerInstance serverInstance)
在 MongoDB.Driver.MongoCursor`1.MongoCursorConnectionProvider.AcquireConnection()
在 MongoDB.Driver.Operations.QueryOperation`1.KillCursor(IConnectionProvider connectionProvider, Int64 cursorId)
在 MongoDB.Driver.Operations.QueryOperation`1.<Execute>d__0.<>m__Finally6()
在 MongoDB.Driver.Operations.QueryOperation`1.<Execute>d__0.System.IDisposable.Dispose()
在 MongoDB.Driver.Operations.QueryOperation`1.<Execute>d__0.MoveNext()
在 System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
在 System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
在 DAL.MongoHelper`1.Find(String collection, IMongoQuery query, String[] fields, String[] sortBys, Int32 skip, Int32 limit, Int64& totalNum)
在 DAL.Service.CommonService.GetNodePageList(MongoPageCriteria criteria)
在 DAL.Service.AppService.GetOrderListForPage(MongoPageCriteria criteria, Order ord)
在 Admin.BLL.AppManager.GetOrderListForPage(MongoPageCriteria criteria, Order order)
在 Admin.View.OrderList.BindData()
在 Admin.View.OrderList.OnLoad(EventArgs e)
在 System.Web.UI.Control.LoadRecursive()
在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
[HttpUnhandledException]: 引发类型为“System.Web.HttpUnhandledException”的异常。
在 System.Web.UI.Page.HandleError(Exception e)
在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
在 System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
在 System.Web.UI.Page.ProcessRequest()
在 System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
在 System.Web.UI.Page.ProcessRequest(HttpContext context)
在 ASP.view_orderlist_aspx.ProcessRequest(HttpContext context) 位置 c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\7b58857c\5cb9b318\App_Web_0b0m0xbf.18.cs:行号 0
在 System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
在 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
--><!--
此错误页可能包含敏感信息,因为 ASP.NET 通过 <customErrors mode="Off"/> 被配置为显示详细错误消息。请考虑在生产环境中使用 <customErrors mode="On"/> 或 <customErrors mode="RemoteOnly"/>。-->
MongoDB的C#驱动报错Server instance 127.0.0.1:27017 is no longer connected的解决方案的更多相关文章
- MySQL数据源驱动报错
报错信息:MySQL数据源驱动报错: 1.mysql8.0以上版本需要连接数据库的JDBC驱动也是8.0版本以上 com.mysql.cj.jdbc.Driver 2.MySQL高版本需要指明是否需要 ...
- 安装sql server managerment studio报错"The instance id is required but it is missing"
问题描述: 今天在安装sql server managerment studio的时候提示报错"The instance id is required but it is missing&q ...
- python 3.5.2安装mysql驱动报错
python 3.5.2安装mysql驱动报错 python 3.5.2安装mysql驱动时出现如下异常: [root@localhost www]# pip install mysql-connec ...
- koa项目用mongoose与mongodb交互,始终报错FormModel is not defined
koa项目用mongoose与mongodb交互,始终报错FormModel is not defined,就是自己定义的model实例始终不能找到,但是明明定义了,这时候就要看大小写了,当创建一个m ...
- Linux 下报错:A Java RunTime Environment (JRE) or Java Development Kit (JDK) must解决方案
一.报错环境:在Linux mint下,前几天还用得很好的的eclipse,今天开机不知为什么这样. Linux 下报错:A Java RunTime Environment (JRE) or Jav ...
- vue安装之后的报错处理---chromedriver@2.35.0 install: `node install.js`
报错:chromedriver@2.35.0 install: `node install.js` 这个错误的解决方法就是在你创建的项目目录,比如你创建的项目叫myVue,然后你就要在myVue这个目 ...
- Scrapy安装报错 Microsoft Visual C++ 14.0 is required 解决办法
Scrapy安装报错 Microsoft Visual C++ 14.0 is required 解决办法原因:Scrapy需要的组 twisted 需要 C++环境编译. 方法一:根据错误提示去对应 ...
- 报错:ipython 6.5.0 has requirement prompt-toolkit<2.0.0,>=1.0.15, but you'll have prompt-toolkit 2.0.15 which is incompatible.
pip install imagededup 时,报错:ipython 6.5.0 has requirement prompt-toolkit<2.0.0,>=1.0.15, but y ...
- hive报错 Another instance of Derby may have already booted the database
刚装好hive后,启动之后showtables;等正常,退出之后再进入,就发现会报错 Caused by: ERROR XSDB6: Another instance ofDerbymay have ...
随机推荐
- webpack的使用二
1.安装 Webpack可以使用npm安装,新建一个空的练习文件夹(此处命名为webpack sample project),在终端中转到该文件夹后执行下述指令就可以完成安装 //全局安装 npm i ...
- jQuery选择器--#id、element和.class
#id 描述 根据给定的ID匹配一个元素.使用任何的元字符作为名称的文本部分, 它必须被两个反斜杠转义:\\ 参数 id 用于搜索的,通过元素的 id 属性中给定的值 element 概述 根 ...
- 20155228 获取技能的成功经验和关于C语言学习的调查
内容提要 你有什么技能比大多人(超过90%以上)更好?针对这个技能的获取你有什么成功的经验?与老师博客中的学习经验有什么共通之处? 有关C语言学习的调查 你是怎么学习C语言的?(作业,实验,教材,其他 ...
- 【2017-2-23】C#switch case分支语句,for循环语句
switch case分支语句 switch(一个变量值) { case 值:要执行的代码段;break; case 值:要执行的代码段;break; … default:代码段;break;(def ...
- Spark学习之路 (十)SparkCore的调优之Shuffle调优
摘抄自https://tech.meituan.com/spark-tuning-pro.html 一.概述 大多数Spark作业的性能主要就是消耗在了shuffle环节,因为该环节包含了大量的磁盘I ...
- 【Redis学习之六】Redis数据类型:集合和有序集合
环境 虚拟机:VMware 10 Linux版本:CentOS-6.5-x86_64 客户端:Xshell4 FTP:Xftp4 jdk8 redis-2.8.18 一.集合 Set无序的.去重的元素 ...
- python os.path.expanduser()
# Expand the user's home directory
- linux常用命令:cd 命令
Linux cd 命令可以说是Linux中最基本的命令语句,其他的命令语句要进行操作,都是建立在使用 cd 命令上的.所以,学习Linux 常用命令,首先就要学好 cd 命令的使用方法技巧. 1. 命 ...
- SpringMVC七种参数绑定简单介绍
a. 默认支持的类型: httpServletRequest, httpservletresponse, httpsession, model 看自己需要, 如果需要用就加 ...
- mongodb可视化工具 studio3t robo3T 下载安装使用介绍
mongodb可视化工具 studio3t robo3T 下载安装使用介绍 下载地址: https://studio3t.com/download robo3T