2017-05-23 5 views
0

우리는 C# 드라이버 버전 2.4.3으로 MongoDB 아틀라스에 연결을 시도하는 asp.net 코어 기반 도커 컨테이너를 가지고 있습니다.MongoDB atlas 연결이 ASP.net 코어를 실행하는 도커 컨테이너 내에서 작동하지 않습니다. kestrel 내부에서 잘 작동

우리가 컨테이너 외부에서 실행할 때 연결이 잘 작동합니다. 즉 kestrel에서 직접. 그러나 컨테이너 내에서 동일한 코드가 실행되면 mongodb 아틀라스와의 연결이 시간 초과됩니다.

세부 사항 : MongoDB를 C# 드라이버 버전 : 2.4.3

연결 문자열 : 하여 MongoDB : // SA : @ cluster0-shard-00-00-po5vp.mongodb.net : 27017, cluster0- shard-00-01-po5vp.mongodb.net:27017,cluster0-shard-00-02-po5vp.mongodb.net:27017/admin?ssl=true & replicaSet = Cluster0-샤드 0 & authSource = 관리자

액세스 할 데이터베이스 : 구성

ASP.net 핵심 버전 : Dockerfile 1.1

BaseImage :/마이크로 소프트

Dockerfile 내용을 aspnetcore 빌드 : 마이크로 소프트는/ WORKDIR/SaaS_Configuration_Microservice COPY ./SaaS_Configuration_Microservice을 aspnetcore-구축 할 수 있습니다. [ "PublishOutput/SaaS_Configuration_Microservice.dll", "DOTNET"80 가 RUN DOTNET RUN의 DOTNET이 PublishOutput 엔트리 포인트 -o -c 자료를 게시 복원

에 노출 우리는 윈도우 10에

전체 황조롱이를 실행 오류 메시지 : ex.Message "CompositeServerSelector {Selectors = ReadPreferenceServerSelector {ReadPreference = {Mode : Primary}}, LatencyLimitingServerSelector {AllowedLatencyRange = 00 : 00 : 00.0150000}}를 사용하여 30000ms 서버를 선택하면 시간 초과가 발생했습니다. {ClusterId : \ "1 \", ConnectionMode : \ "ReplicaSet": 유형 : \ "ReplicaSet \", 상태 : \ "Disconnected \", 서버 : [{ServerId : \ "{ClusterId : 1, EndPoint : \"Unspecified/cluster0-shard-00-00-po5vp. mongodb.net : 27017 \ "} \", EndPoint : \ "지정되지 않음/cluster0-shard-00-00-po5vp.mongodb.net : 27017 \", 상태 : \ "연결 끊김 \", 유형 : \ "알 수 없음 \" , HeartbeatException : \ "MongoDB.Driver.MongoConnectionException : 서버에 연결하는 동안 예외가 발생했습니다. ---> MongoDB.Driver.Core.WireProtocol.CommandWireProtocol 1.<ExecuteAsync>d__11.MoveNext()\n--- End of stack trace from previous location where exception was thrown ---\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\n at MongoDB.Driver.Core.Connections.ConnectionInitializer.<InitializeConnectionAsync>d__3.MoveNext()\n--- End of stack trace from previous location where exception was thrown ---\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\n at MongoDB.Driver.Core.Connections.BinaryConnection.<OpenHelperAsync>d__48.MoveNext()\n --- End of inner exception stack trace ---\n at MongoDB.Driver.Core.Connections.BinaryConnection.<OpenHelperAsync>d__48.MoveNext()\n--- End of stack trace from previous location where exception was thrown ---\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\n at MongoDB.Driver.Core.Servers.ServerMonitor.<HeartbeatAsync>d__27.MoveNext()\" }, { ServerId: \"{ ClusterId : 1, EndPoint : \"Unspecified/cluster0-shard-00-01-po5vp.mongodb.net:27017\" }\", EndPoint: \"Unspecified/cluster0-shard-00-01-po5vp.mongodb.net:27017\", State: \"Disconnected\", Type: \"Unknown\", HeartbeatException: \"MongoDB.Driver.MongoConnectionException: An exception occurred while opening a connection to the server. ---> MongoDB.Driver.MongoCommandException: Command failed.\n at MongoDB.Driver.Core.WireProtocol.CommandWireProtocol 1. MongoDB.Driver.MongoCommandException : 명령이 실패했습니다. \ N MongoDB.Driver.Core.WireProtocol.CommandWireProtocol 1.ProcessReply(ConnectionId connectionId, ReplyMessage 1 답장) \ N 0120.1.ProcessReply (ConnectionId connectionId, ReplyMessage 1 reply)\n at MongoDB.Driver.Core.WireProtocol.CommandWireProtocol 1.d__11.MoveNext() \ n --- 예외가 throw 된 이전 위치에서 스택 추적 끝 - \ n System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() \ n System.Runtime.CompilerServices. TaskAwaiter.HandleNonSuccessAndDebuggerNotification (작업 작업) \ n MongoDB.Driver.Core.Connections.ConnectionInitializer.d__3.MoveNext() \ n --- 예외가 발생한 이전 위치의 스택 추적 --- System.Runtime의 \ n .ExceptionServices.ExceptionDispatchInfo.Throw() \ n System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (작업 작업) \ n MongoDB.Driver.Core.Connections.BinaryConnection.d__48.MoveNext() \ n --- 내부 끝 전의 ception stack trace --- \ n MongoDB.Driver.Core.Connections.BinaryConnection.d__48.MoveNext() \ n --- 예외가 발생한 이전 위치의 스택 추적 --- System.Runtime의 \ n. ExceptionServices.ExceptionDispatchInfo.Throw() \ n System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (작업 작업) \ n MongoDB.Driver.Core.Servers.ServerMonitor에서 \ n."Endpoint : \", Endpoint : \ ", Endpoint : \", Endpoint : \ "Unknown/cluster0-shard-00-02-po5vp.mongodb.net : 27017 \ 지정되지 않음/cluster0-shard-00-02-po5vp.mongodb.net : 27017 \ ", 상태 : \"연결 끊김 \ ", 유형 : \"알 수 없음 \ ", HeartbeatException : \"MongoDB.Driver.MongoConnectionException : 서버에 대한 연결을 엽니 다. ---> MongoDB.Driver.MongoCommandException : 명령이 실패했습니다. \ n MongoDB.Driver.Core.WireProtocol.CommandWireProtocol 1.ProcessReply(ConnectionId connectionId, ReplyMessage 1 답장) \ n MongoDB.Driver.Core.WireProtocol.CommandWireProtocol`1.d__11.MoveNext() \ n --- 예외가 발생한 이전 위치의 스택 추적 끝 - \ n System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() \ n System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (작업 태스크) \ n \ n --- 예외가 발생한 이전 위치의 스택 추적 끝 - System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() \ n의 \ n에서 스택 추적 끝내기 \ n - n에서 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (작업 작업) \ n MongoDB.Driver.Core.Connections.BinaryConnection.d__48.MoveNext() \ n --- 내부 예외 스택 추적 끝 - \ n at MongoDB.Driver.Core.Connections.BinaryConnection.d__48.MoveNext() \ n --- sta의 끝 예외가 발생한 이전 위치에서의 ck 추적 --- System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() \ n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (작업 태스크) \ n MongoDB.Driver.Core에서 \ n .Servers.ServerMonitor.d__27.MoveNext() \ "}]}." 문자열

내부 예외 : 널 (null)

+0

Google에 Ping하고 https://cloud.mongodb.com/이 (가) 컨테이너 내부에서 정상적으로 작동합니다. –

답변

1

"마이크로 소프트/aspnetcore 빌드"리눅스 이미지이고 버그가 : https://docs.atlas.mongodb.com/driver-connection/#c-net-driver-example

SNI TLS를 지원하지 않습니다

중요 .NET 핵심 라이브러리 Linux 및 OSX의 경우 확장 프로그램 이러한 작동중인 시스템에서 .NET 코어를 사용하는 응용 프로그램은 Atlas Free Tier 클러스터에 연결할 수 없습니다.

문제는 dotnet/corefx github page에서 추적됩니다.

+0

명확히하기; 귀하가 Atlas Free Tier를 사용하고 있다고 가정합니다. 당신이 아니라면, 그것은 또 다른 문제가 아닐 수 있습니다. –

관련 문제