2

I've the following scenario

  • Sitecore 8.2 update 2
  • MongoDB 3.2

Now, I'm trying to setup authentication to MongoDB, and as soon as I update the mongod.cfg

security: authorization: enabled

and the ConnectionStrings.config

mongodb://myuser:mypassword@MongoServer/Sitecore_Analytics

An error shows up on Sitecore logs

Exception: MongoDB.Driver.MongoConnectionException Message: Unable to connect to server MongoServer:27017: Error: 18 - Authentication failed..

However, I've granted myuser proper permissions on the MongoDB Collection

use Sitecore_Analytics db.createUser( { user: "myuser", pwd: "mypassword", roles: [ { role: "readWrite", db: "Sitecore_Analytics" } ] } )

Also, using RoboMongo to connect to the MongoDB works!

closed as off-topic by Mark Cassidy Mar 27 '17 at 16:10

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question was caused by a problem that can no longer be reproduced or a simple typographical error. While similar questions may be on-topic here, this one was resolved in a manner unlikely to help future readers. This can often be avoided by identifying and closely inspecting the shortest program necessary to reproduce the problem before posting." – Mark Cassidy
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Have you tried restarting the app pool? Also, can you please provide the full connection string? And does the MongoServer correct? – Hishaam Namooya Mar 24 '17 at 21:27
  • I've Recycled the AppPool, restarted IIS but no luck. I'll get the ConnectionStrings and add on the question – Vinicius Deschamps Mar 24 '17 at 22:33
  • Did you create an admin user before creating the new user? – Hishaam Namooya Mar 24 '17 at 22:46
  • Yes, I did and I'll try modify based on your answer here – Vinicius Deschamps Mar 24 '17 at 23:05
0

Looks like I've a typo in my ConnectionString, and the database Tracking_Contact didn't exist at all in the MongoDB.

However, before figure this out, I did uninstall and install all MongoDB again, and when I first accessed the Sitecore the databases were created and Tracking_Contact was named Cracking_Contact by mistake.

After fix it, and re-apply the permissions accordingly and follow the tips from Hishaam Namoya, everything start to working!

Not the answer you're looking for? Browse other questions tagged or ask your own question.