The following forum(s) have migrated to Microsoft Q&A (Preview): Developing Universal Windows apps!
Visit Microsoft Q&A (Preview) to post new questions.

Learn More

Can't connect UWP app to MongoDB RRS feed

  • Question

  • I'm developing a UWP app using C# and the MongoDB connection works perfectly in the development computer. When I tried to export and install it in a different desktop it did not work.

    I have some peculiarities on the target computer: no internet and no Visual Studio. I export my app, using the "Create App Packages" on Visual Studio, install all dependencies in the target desktop, and install the App.

    Everything works, but the MongoDB Connection. When it tries to connect to the MongoDB Serve (local installation on target computer), it can't connect and I receive a timeout error.

    What I know so far:

    • Nothing is wrong with the MongoDB installation, I can connect to it from the Mongo Compass and from a working 'App' from a different computer.
    • When I downloaded the Remote Debug Tools from Visual Studio, I got a message "installing missing libraries", and it started working (I had to get a new windows installation to reproduce the problem, without remote debugging).
    • I already tried to install the missing NuGet packages (MongoDB.Driver, MongoDB.Bson and MongoDB.Driver.Core) on the target computer, but it did not seem to change anything.
    • Firewall is disabled.
    • All permissions were added to the UWP app.
    • Tried to connect without the loopback, but also did not work

    Target windows version: 1809

    MongoDB Packages version: 2.9.3

    Visual Studio: 17

    _client = new MongoClient(connectString);
    _db = _client.GetDatabase(database);
    BsonDocument doc = _instance._db.RunCommand((Command<BsonDocument>)"{ping:1}");
    IsConnected = doc["ok"] == 1;
    Logger.Log("[MONGO] Connected to MongoDB");

    Error message: "A timeout occured after 30000ms selecting a server using CompositeServerSelector...."

    Wednesday, November 20, 2019 7:05 PM

All replies