间歇性 MongoDB 连接问题:尝试以访问权限禁止的方式访问套接字

2024-04-19

当尝试将文档写入我的集合时,我偶尔会抛出以下异常。

我正在使用 mLabs 托管的 MongoDB 3.0.7。我们的应用程序托管在 Azure 中(作为 Web 应用程序),我使用的是 C# 2.2.3 SDK。

MongoDB.Driver.MongoConnectionException:发生异常 打开与服务器的连接。 ---> System.Net.Sockets.SocketException:尝试访问 套接字以其访问权限禁止的方式 191.235.xxx.xxx:54128 位于 System.Net.Sockets.Socket.Connect(IPAddress[] 地址,Int32 端口)
在 System.Net.Sockets.Socket.Connect(字符串主机,Int32 端口)在 MongoDB.Driver.Core.Connections.TcpStreamFactory.Connect(套接字 套接字、EndPoint endPoint、CancellationToken 取消令牌)位于 MongoDB.Driver.Core.Connections.TcpStreamFactory.CreateStream(EndPoint endPoint、CancellationToken 取消令牌)位于 MongoDB.Driver.Core.Connections.BinaryConnection.OpenHelper(CancellationToken cancelledToken) --- 内部异常堆栈跟踪结束 --- at MongoDB.Driver.Core.Connections.BinaryConnection.OpenHelper(CancellationToken 取消令牌)位于 MongoDB.Driver.Core.Connections.BinaryConnection.Open(CancellationToken 取消令牌)位于 MongoDB.Driver.Core.ConnectionPools.ExclusiveConnectionPool.AcquiredConnection.Open(CancellationToken 取消令牌)位于 MongoDB.Driver.Core.Servers.ClusterableServer.GetChannel(CancellationToken 取消令牌)位于 MongoDB.Driver.Core.Bindings.ServerChannelSource.GetChannel(CancellationToken 取消令牌)位于 MongoDB.Driver.Core.Bindings.ChannelSourceHandle.GetChannel(CancellationToken 取消令牌)位于 MongoDB.Driver.Core.Operations.BulkMixedWriteOperation.Execute(IWriteBinding 绑定、CancellationToken 取消令牌)位于 MongoDB.Driver.OperationExecutor.ExecuteWriteOperation[TResult](IWriteBinding 绑定、IWriteOperation'1 操作、CancellationToken 取消令牌)位于 MongoDB.Driver.MongoCollectionImpl'1.ExecuteWriteOperation[TResult](IWriteOperation`1 操作,CancellationToken(取消令牌) MongoDB.Driver.MongoCollectionImpl'1.BulkWrite(IEnumerable'1 请求, BulkWriteOptions 选项、CancellationToken 取消令牌)位于 MongoDB.Driver.MongoCollectionBase'1.InsertOne(TDocument 文档, InsertOneOptions 选项、CancellationToken(取消令牌)


如果您达到沙箱限制,就会发生这种情况。我的旧答案中有更多详细信息Azure Web 应用程序间歇性崩溃 https://stackoverflow.com/questions/30909733/intermittent-crashes-in-azure-web-application/30921112#30921112

要了解沙箱限制,请参阅https://github.com/projectkudu/kudu/wiki/Azure-Web-App-sandbox https://github.com/projectkudu/kudu/wiki/Azure-Web-App-sandbox

也遇到过http://www.freekpaans.nl/2015/08/starving-outgoing-connections-on-windows-azure-web-sites/ http://www.freekpaans.nl/2015/08/starving-outgoing-connections-on-windows-azure-web-sites/关于同一主题写得很好

编辑 - 2018 年 2 月

如果您现在遇到此问题,请转到诊断和解决刀片为您的应用程序Azure 门户并检查TCP连接瓦。它应该为您提供有关消耗最大端口的站点的信息,并允许您监控实例范围内的连接状态。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

间歇性 MongoDB 连接问题:尝试以访问权限禁止的方式访问套接字 的相关文章

随机推荐