[CSHARP-1239] MongoClient misinterprets connection settings Created: 12/Apr/15 Updated: 05/Apr/19 Resolved: 04/Apr/16 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | API, Connectivity |
| Affects Version/s: | 2.0 |
| Fix Version/s: | None |
| Type: | Task | Priority: | Blocker - P1 |
| Reporter: | Lukas Wagner | Assignee: | Unassigned |
| Resolution: | Cannot Reproduce | Votes: | 0 |
| Labels: | connection, question | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Client: Linux Mint 17.1 x86_64 |
||
| Attachments: |
|
| Description |
|
The default MongoClient Constructor tries to connect to Unspecified/localhost:27017 instead of localhost:27017. Even if the constructor gets either MongoClientSettings or a connection string it does that strange thing of adding Unspecified/ as a prefix to the host name. |
| Comments |
| Comment by Lukas Wagner [ 16/Apr/15 ] |
|
Hi Craig, it's in all tests the same with an IP Address added (127.0.0.1 as well as the external IP address of the adapter). This is the output of 'mono --version': I'm using monodevelop (the opt version which also has the dlang tools aboard, not from the official repos) and I set the project up to be using 'mono/.Net 4.5'. |
| Comment by Craig Wilson [ 16/Apr/15 ] |
|
Have not had a chance yet Lukas... However, I have another question and a request:
Craig |
| Comment by Lukas Wagner [ 16/Apr/15 ] |
|
Were you able to reproduce? If not I can give you a virtual machine with the error. |
| Comment by Lukas Wagner [ 14/Apr/15 ] |
|
Thanks a lot |
| Comment by Craig Wilson [ 14/Apr/15 ] |
|
Lukas, I'm trying to reproduce this. We test on MacOSX and it's not a problem there. I'll fire up a linux box and see if I can reproduce. Craig |
| Comment by Lukas Wagner [ 14/Apr/15 ] |
|
I think the heading of this Report is wrong it shoud have something to do with "No route to host for C# driver on Linux". |
| Comment by Lukas Wagner [ 14/Apr/15 ] |
|
It's the same on CentOS 7 (Fresh and clean install, mongodb on localhost). |
| Comment by Lukas Wagner [ 14/Apr/15 ] |
|
I can even connect with java and c++. It has to be something about the c# driver. |
| Comment by Lukas Wagner [ 13/Apr/15 ] |
|
I think I have to rebuild the mongo driver with the d:TRACE compiler option? Any tips? |
| Comment by Lukas Wagner [ 13/Apr/15 ] |
|
I learned everything there is about tracing at msdn, but it just doesn't work. I defined he sources and I defined an output and I added the compiler option. I can't see any output. |
| Comment by Lukas Wagner [ 12/Apr/15 ] |
|
I actually have no Idea how to trace C#, I recently began using it. I will try and find out how it works. For now I found out hat there is the possibility to create an app.config file. I pasted the code in there, cleaned and recompiled. Based upon how this piece of config file looks, I would expect there to be a network.log either in the directory I'm running the program from or in the directory the executable resides in. However. there's nothing like that. |
| Comment by Craig Wilson [ 12/Apr/15 ] |
|
Lukas, I'm not sure what to say. I can run your code without failure. In fact, this is almost exactly how our entire test suite runs. There is going to be some setting somewhere that is causing this issue. If you could, please turn on network tracing, particularly the System.Net.Sockets one and maybe we can see inside the trace what is going on down in the network stack. Craig |
| Comment by Lukas Wagner [ 12/Apr/15 ] |
|
The same thing happens here Code_v2.cs. I can connect to this server via robomongo. It is running whithin a virtual machine |
| Comment by Craig Wilson [ 12/Apr/15 ] |
|
Hi Lukas, Sorry you are having trouble. The Unspecified/localhost:27017 is the output of a DnsEndPoint's ToString() method. What is really happening here is that we can't connect to localhost:27017. Are you sure the mongod process is running? The root exception is this: System.Net.Sockets.SocketException: Connection refused. This generally means that nothing is listening on localhost:27017. Craig |