Sitecore Instance Manager error
It is near to midnight in India and my phone is saying me that I should go to sleep. But before I go for sleep. Would like to make sure I blog my learning which took most part of my day and was scrathing my head.
So, I got a new laptop which has Windows 10 on it. Was trying to configure your and mine favorite Sitecore Tool – SIM (If you haven’t heard of Sitecore Instance Manager (SIM) and you are newbie then it’s fine. It is Army knife of Sitecore Developer, and a must need to have tool in your toolset)
After installing was trying to pass through initial configuration and it was tough to pass through following dialog.
“You probably don’t have necessary permissions set. Please try to click ‘Grant’ button before you proceed.”
If you are also facing this then this post might help you. So, let’s see what I found while troubleshooting this.
- I went to c:\inetpub\wwwroot – And made sure that NETWORK SERVICE user has full access on main folder and sub folders – It was there!
- Did a quick search and found few good articles:
- In Summary, This seems file system related error. But behind the scenes it also tries to check SQL rights. So, go back and make sure your connection string is right. What I would suggest you to do is. Take that username and password and try to login using SQL Server Management studio and try to create dummy database and delete it using same credentials. This should work. Also, make sure you are running your SQL Service using NETWORK SERVICE account
- Also, please make sure you are running SIM as Administrator user
- One more thing, Make sure your SIM.EXE is not blocked, as it was downloaded from Web. If so, please unblock it
- After doing SQL Server related changes make sure you restart SQL Server – Then only changes will take effect
Then I got busy with other things and thought to find Plan B. Which was installing Plain Sitecore using Sitecore installer. I did that using Sitecore Installer (exe) was able to install Sitecore successfully!
But still that problem was still going on in back of my mind [We are same! ;)]. So, thought to ask few awesome Sitecore developers internally they gave few ideas. But everything was tried. Was about to go to bed and thought to troubleshoot a bit and then go for sleep. And I tried to reproduce the issue. But couldn’t, it was fixed! How?
As per my understanding:
- All above mentioned changes
- And Installing Sitecore using Sitecore installer
Fixed this issue! I can’t say it confidently. Till I get fresh laptop where I try exact same steps or one of you also try the same and confirm it for us!
Or Alen might have some idea and he improves that error message which indicates exact error message.
After writing above line, I realized that SIM is now open source and Alen and Sitecore’s vision will be fulfilled. If I am able to find this BUG and Fix it or narrow it down. So, I went ahead and cloned repository in my local and have been able to locate code which is causing this behavior. message variable is same for both scenarios – File system and local
And this is what TestSqlServer method does:
After looking at code, I noticed that there has been lot of logging going on. So, thought to find out log file and found it here : C:\Users\<USERNAME>\AppData\Roaming\Sitecore\Sitecore Instance Manager\Logs and found following errors:
1 13:25:09,168 DEBUG SQL Server Account name: LocalSystem
1 13:25:19,185 ERROR Cannot create a test database
System.Data.SqlClient.SqlException (0x80131904): Cannot open database “DBNAMEWHICHDOESNTEXIST” requested by the login. The login failed.
Login failed for user ‘lsa’.
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
at SIM.Adapters.SqlServer.SqlServerManager.TestSqlServer(String rootPath, String connectionString)
1 13:25:42,751 DEBUG return False (System.Boolean)
After verifying connection string setting in SIM, I noticed some change:
Not working : user id=sa;password=*****;Data Source=MACHINENAME\SQLEXPRESS;Database=DBNAMEWHICHDOESNTEXIST
Working : Data Source=(local)\SQLEXPRESS;Initial Catalog=master;User ID=sa;Password=******;Connect Timeout=1
Working one must have been modified by Sitecore installer. Because I haven’t changed it.
This would have been easy fix. If error message was in sync with backend error — Now, we understand end user’s challenges better! 😉
- If you are getting such error, along with file system verify SQL related configurations
- Look at SIM Logs
- Don’t forget SIM is open source, clone repository and troubleshoot!
- Found and fixed it? Don’t forget to contribute your fix to make SIM better — Yes, Yes, I am also going to do that. Once I test my solution in local
Have a seamless SIM installation! 🙂