Format of the initialization string does not conform to specification starting at index 0 on azure - entity-framework

Have been with thi problem for hours, this is my connectionstring:
<connectionStrings>
<add name="OL4RENTDb"
connectionString="Server=v812xrqz2w.database.windows.net;Database=ol4rentDB;User ID=AdminOL4RENT#v812xrqz2w;Password=Grupo501TSI;Trusted_Connection=False;Encrypt=True;MultipleActiveResultSets=True;" providerName="System.Data.SqlClient" />
</connectionStrings>
an error:
[ArgumentException: Format of the initialization string does not conform to specification starting at index 0.]
System.Data.Common.DbConnectionOptions.GetKeyValuePair(String connectionString, Int32 currentPosition, StringBuilder buffer, Boolean useOdbcRules, String& keyname, String& keyvalue) +5314705
System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey) +124
System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules) +95
System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) +59
Do you see any problem there?
I am deploying to azure..

I had the same error and I fix it by going via FTP to my Azure Website and edited the Web.Config. I noticed that a new connection string entry has been added. I removed it to keep those that I had on my PC and everything worked well. So, if you have this error when you deploy to Azure, check your connections strings.

The problem wasnt that web.config's connection string, but the one you specify in publish settings, the one that azure will use to connect to db.
Lets say you can have in the local pc the connection string to you local database, and when you publish you put the azure database connection string, and that override your local connection string at web.config.

Related

Database from AlwaysOn availability group restored as normal database

I have a problem with a normal SQL database restored from a DB set in AlwaysOn high availability group in SQL Server 2017.
I restored a copy of production db to a different server, to be used as QA test database, with a different name also - MyDB_demo
The problem is, the QA app copy (same code as production with new development enhancements) get an error at some point.
Even if my conn str points to MyDB_demo, I get the following error
[SqlException (0x80131904): The target database ('MyDB') is in an availability group and is currently accessible for connections when the application intent is set to read only. For more information about application intent, see SQL Server Books Online.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action 1 wrapCloseInAction) +2444190
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action 1 wrapCloseInAction) +5775712
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +285
System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +4169
System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() +58
System.Data.SqlClient.SqlDataReader.get_MetaData() +89
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption) +409
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest) +2127
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) +911
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +64
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +240
System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +41
System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) +12
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +139
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +136
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) +88
MyApp.SqlHelper.ExecuteDataset(SqlConnection connection, CommandType commandType, String commandText, SqlParameter[] commandParameters) +163
MyApp.PermitFunctions.GetSystemMessages(String sp, Int32 iPermitID, Int32 iAppID, SqlConnection cn) +219
MyApp.Municipality.LoadSystemMessage() +3869
MyApp.Municipality.Page_Load(Object sender, EventArgs e) +101
System.Web.UI.Control.OnLoad(EventArgs e) +95
System.Web.UI.Control.LoadRecursive() +59
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +678
Is there any reference in the newly restored DB (named now MyDB_demo) that stores the original name of production DB and why is it trying to access it?
Any suggestion is appreciated.
EDIT
Actually, the server used to restore MyDB_demo is one of the secondary nodes for AlwasyOn availability group; it also contains a RO copy of production database, MyDB.
So the server has:
RO copy of production DB (MyDB)
normal, stand-alone db restored for QA - MyDB_demo
Hence, I understand the error message - it would makes sense if I tried to access directly the secondary, RO copy of production db from connection string.
But I do not: the connection string (which I double-checked) is trying to connect to QA db, MyDB_demo.
Here is some additional info:
the error is thrown in SQLHelper class, the helper class from MS to work with SQL Server, in the ExecuteDataset function
the error is thrown ONLY on one stored procedure - lot of other stored procedures and also direct SQL statements run just fine
I inspected the stored procedure, thinking it might contains accidentally a hardcoded reference to DB name - it doesn't
and the strange part - I run the stored procedure with the same parameters as called from the app in SSMS - and it run just fine - no error
So it looks somehow the connection string MIGHT be altered (!!!) is some way by the NET application itself, and only for this stored procedure?
Anyone ever encountered something like this?
Thank you
Due to the strange (read: stupid) situation that the culprit SP fails only when called from within app, but runs ok when tried in SSMS, I tried a "stupid" approach: I inspected its code, commented out two fields that were set with sub-selects like select top 1 from ..... where.... (actually I replaced theit values with dummy ones) and I changed an Order By field that was initially specified like "InspectionType" Desc, which I removed quotation marks from.
Doing this, the SP suddenly started to work ok even when called from the app.
Then I reverted all changes to original (added quoted back and put back the sub-selects) and the SP continued to work ok.
So ... problem solved.
Stupid approach for stupid problem (!?!?!)
In any case, if anyone has a better idea or explanation of what might have happened, I'd be glad to hear it
EDIT
I think I understand the fix.
By editing and saving the stored procedure, its query plan was recompiled.
So the original error might have been caused by the old query plan.
But why did it referenced the database name? Is the actual database name referenced in query plans? This looks a little odd to me.
And another question (open):
Does the SQL Server optimizer detect if a DB runs in high-availability mode, and when optimizing the queries, does it decide if a query is read-only mode and automatically redirects it toward a read-only node? Even if the ApplicationIntent readonly parameter is not present in connection string?
Because it was not in this case, even in production - we just implemented AlwaysOn functionality and are in the process of updating app to take advantage of R/O nodes.
Any comments are appreciated

Intermittent Entity framework 3.4 error in hosted environment (medium trust)

I have an application that is being hosted in medium trust environment (godaddy). I am getting strange problem that occurs periodically when I am trying to use the application.
Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
I have read a bunch of other posts that talk about issues running in a medium trust environment. My question really goes to trying to understand why it works sometimes and other times I get the above message. When error occurs it will eventually correct itself. And obvously if I recycle IIS that fixes is as well. I'm hoping their is a workaround for this.
Based on the callstack it looks like it related to esablishing the connection and trying to load the MetadataWorkspace from my assembly. My MetadataWorkspace is contained in my App_Code folder for my web app.
Partial Callstack:
System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
at System.Security.CodeAccessPermission.Demand()
at System.Reflection.Assembly.VerifyCodeBaseDiscovery(String codeBase)
at System.Reflection.Assembly.GetName(Boolean copiedName)
at System.Reflection.Assembly.GetName()
at System.Data.Metadata.Edm.DefaultAssemblyResolver.AssemblyComparer`1.Equals(T x, T y)
at System.Collections.Generic.HashSet`1.AddIfNotPresent(T value)
at System.Collections.Generic.HashSet`1.Add(T item)
at System.Data.Metadata.Edm.DefaultAssemblyResolver.GetAllDiscoverableAssemblies()
at System.Data.Metadata.Edm.DefaultAssemblyResolver.GetWildcardAssemblies()
at System.Data.Metadata.Edm.MetadataArtifactLoaderCompositeResource.LoadResources(String assemblyName, String resourceName, ICollection`1 uriRegistry, MetadataArtifactAssemblyResolver resolver)
at System.Data.Metadata.Edm.MetadataArtifactLoaderCompositeResource.CreateResourceLoader(String path, ExtensionCheck extensionCheck, String validExtension, ICollection`1 uriRegistry, MetadataArtifactAssemblyResolver resolver)
at System.Data.Metadata.Edm.MetadataArtifactLoader.Create(String path, ExtensionCheck extensionCheck, String validExtension, ICollection`1 uriRegistry, MetadataArtifactAssemblyResolver resolver)
at System.Data.EntityClient.EntityConnection.SplitPaths(String paths)
at System.Data.EntityClient.EntityConnection.GetMetadataWorkspace(Boolean initializeAllCollections)
at System.Data.Objects.ObjectContext.RetrieveMetadataWorkspaceFromConnection()
at System.Data.Objects.ObjectContext..ctor(EntityConnection connection, Boolean isConnectionConstructor)
at System.Data.Objects.ObjectContext..ctor(String connectionString, String defaultContainerName)
I there a workaround for this?

"URI formats are not supported" exception when using |DataDirectory| in Entity Framework connection string

I have a unit test project in Visual Studio 2012 where I am storing the AdventureWorks MDF file for SQL Server 2012 (the file is named AdventureWorks2012_Data.mdf). In the Visual Studio Server Explorer, I am able to add the MDF in the Data Connections and browse the database. Right clicking on $/Data Connections/AsventureWorks2012_Data.mdf and selecting properties gives me access to the connection string as follows:
Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Projects\Common\Source\Framework\Framework.Data.Tests\AdventureWorks2012_Data.mdf;Integrated Security=True;Connect Timeout=30
I copied this into my Entity Framework connection string in the app.config file as follows:
<!-- Works :-) -->
<connectionStrings>
<add name="AdventureWorksEntities"
connectionString="metadata=res://*/Repository2Tests.AdventureWorks.csdl|res://*/Repository2Tests.AdventureWorks.ssdl|res://*/Repository2Tests.AdventureWorks.msl;provider=System.Data.SqlClient;provider connection string="Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Projects\Common\Source\Framework\Framework.Data.Tests\AdventureWorks2012_Data.mdf;Integrated Security=True;Connect Timeout=30App=EntityFramework""
providerName="System.Data.EntityClient" />
</connectionStrings>
Note that the AttachDbFilename contains the full path of the MDF file as:
C:\Projects\Common\Source\Framework\Framework.Data.Tests\AdventureWorks2012_Data.mdf
When I run the unit tests, everything is fine as expected.
I changed AttachDbFilename to |DataDirectory|\AdventureWorks2012_Data.mdf as described in "ADO.NET Entity Framework Connection Strings" and I set the DataDirectory as described in "ADO.NET |DataDirectory| where is this documented?" so that my connection string now is as follows:
<!-- Doesn't work :-( -->
<connectionStrings>
<add name="AdventureWorksEntities"
connectionString="metadata=res://*/Repository2Tests.AdventureWorks.csdl|res://*/Repository2Tests.AdventureWorks.ssdl|res://*/Repository2Tests.AdventureWorks.msl;provider=System.Data.SqlClient;provider connection string="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\AdventureWorks2012_Data.mdf;Integrated Security=True;Connect Timeout=30;App=EntityFramework""
providerName="System.Data.EntityClient" />
</connectionStrings>
The change to using |DataDirectory| resulted in the following runtime error:
System.Data.EntityException: The underlying provider failed on ConnectionString. ---> System.ArgumentException: URI formats are not supported.
HResult: -2147024809
at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength)
at System.IO.Path.GetFullPath(String path)
at System.Data.Common.ADP.GetFullPath(String filename)
at System.Data.Common.DbConnectionOptions.ExpandDataDirectory(String keyword, String value, String& datadir)
at System.Data.SqlClient.SqlConnectionString..ctor(String connectionString)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous)
at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions)
at System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key)
at System.Data.SqlClient.SqlConnection.set_ConnectionString(String value)
at System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString)
--- End of inner exception stack trace ---
HResult: -2146233087
at System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString)
at System.Data.Entity.Internal.LazyInternalConnection.TryInitializeFromAppConfig(String name, ConnectionStringSettingsCollection connectionStrings)
at System.Data.Entity.Internal.LazyInternalConnection.Initialize()
at System.Data.Entity.Internal.LazyInternalConnection.get_ConnectionHasModel()
at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
at System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
at System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext()
at System.Data.Entity.Internal.Linq.InternalSet`1.Create()
I have researched this for a couple days now and tried countless variations without success. I even debugged into Microsoft code but with compiler optimizations I am unable to see any debugging information on the stack.
Has anyone run across this specific problem?
I finally solved the problem when I set out to submit a bug report to Microsoft and worked on reproduction steps.
To make a long story short, the problem was in the code that set the DataDirectory:
AppDomain.CurrentDomain.SetData("DataDirectory", dataDirectory);
The issue was that my dataDirectory variable was getting initialized as file://C:/myfolder/etc/ instead of C:\myfolder\etc\. I corrected the code responsible for that and the problem is resolved. Incidentally, the code I used is:
// in the test assembly initializer
String dataDirectory = AppDomain.CurrentDomain.GetApplicationPath();
AppDomain.CurrentDomain.SetData("DataDirectory", dataDirectory);
// GetApplicationPath calls into the following extension method
/// <summary>
/// Defines a set of extension methods on <see cref="AppDomain"/> objects.
/// </summary>
public static class AppDomainExtensions
{
/// <summary>
/// Gets the application path (works for both ASP.NET and unit tests).
/// </summary>
/// <returns></returns>
public static string GetApplicationPath(this AppDomain appDomain)
{
string binPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
return binPath.Substring(0, binPath.LastIndexOf("bin", StringComparison.InvariantCultureIgnoreCase));
}
}

Unavailable XRMServices/2011/Organization.svc

I try to discover service endpoint .../XRMServices/2011/Organization.svc and I've this error:
An error has occurred.
Try this action again. If the problem continues, check the Microsoft Dynamics CRM Community for solutions or contact your organization's Microsoft Dynamics CRM Administrator. Finally, you can contact Microsoft Support.
System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.Crm.MainApplication.Application_Error(Object sender, EventArgs eventArguments)
Stack trace:
Error Description:
Generic SQL error.
Error Details:
Generic SQL error.
Full Stack:
[SqlException: Cannot open database "ASPState" requested by the login. The login failed.
Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.]
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)
at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, TimeoutTimer timeout)
at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, TimeoutTimer timeout, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at System.Web.SessionState.SqlSessionStateStore.SqlStateConnection..ctor(SqlPartitionInfo sqlPartitionInfo, TimeSpan retryInterval)
[HttpException: Unable to connect to SQL Server session database.]
at System.Web.SessionState.SqlSessionStateStore.ThrowSqlConnectionException(SqlConnection conn, Exception e)
at System.Web.SessionState.SqlSessionStateStore.SqlStateConnection..ctor(SqlPartitionInfo sqlPartitionInfo, TimeSpan retryInterval)
at System.Web.SessionState.SqlSessionStateStore.GetConnection(String id, Boolean& usePooling)
at System.Web.SessionState.SqlSessionStateStore.DoGet(HttpContext context, String id, Boolean getExclusive, Boolean& locked, TimeSpan& lockAge, Object& lockId, SessionStateActions& actionFlags)
at System.Web.SessionState.SqlSessionStateStore.GetItemExclusive(HttpContext context, String id, Boolean& locked, TimeSpan& lockAge, Object& lockId, SessionStateActions& actionFlags)
at System.Web.SessionState.SessionStateModule.GetSessionStateItem()
at System.Web.SessionState.SessionStateModule.BeginAcquireState(Object source, EventArgs e, AsyncCallback cb, Object extraData)
at System.Web.HttpApplication.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
What may cause the problem, what is wrong with CRM?
Since you are using NETWORK SERVICE, you need to make sure the webserver's computer account is added to the SQLAccessGroup in Active Directory. Normally this is done for you during CRM setup, but if you want to change the account later you must remember to add the new account to this group manually. Here is a link that describes the different groups that CRM uses:
http://ayazahmad.wordpress.com/2007/01/26/active-directory-security-groups-for-mscrm/
I've seen a similar message when the user did not have a role assigned, but that occured in a test enviroment, still worth checking.
I completely re-installed development stack and the same happened again, I re-installed my virtual machine and it worked, seems like it some unknown issue. Now I'll try to reproduce the same errors on a new instances of a virtual machine.
Thanks to all)
I have seen also this message on my CRM server. What I've done is to just enable and disable anonymous authentication on IIS, and thing worked for me. Also I've played with web.config, service settings, but later I get that section back as it was on first install of CRM.
In my oppinion, IIS doesn't tell WCF how to auth, and couple of cold restarts, and enabling and disabling anonymous auth. wake up WCF.
Your AppPool needs to be a User that has access to the database.
With regards to the WCF Service,
Check your IIS Website Authentication settings, for WCF Services you need
Anonymous Authentication Enabled
ASP.NET Impersonation Enabled
Windows Authentication Enabled
for On-Premise installation running in an AD environment.
We also had the issue and it was resolved after restarting IIS.

How to fix “The ConnectionString property has not been initialized” in nopCommerce

I'm trying to integrate nopCommerce into a third party system but am hitting a problem when I try to access any nopCommerce pages. Because I'm integrating with a third party system I've had to merge web.configs and copy all files over. I have a standalone install of nopCommerce aswell and that is running fine.
Any help would be greatly appreciated.
The error I am getting is as follows:
The ConnectionString property has not been initialized.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: The ConnectionString property has not been initialized.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidOperationException: The ConnectionString property has not been initialized.]
System.Data.SqlClient.SqlConnection.PermissionDemand() +5038498
System.Data.SqlClient.SqlConnectionFactory.PermissionDemand(DbConnection outerConnection) +20
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +126
System.Data.SqlClient.SqlConnection.Open() +125
System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) +52
[EntityException: The underlying provider failed on Open.]
System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) +161
System.Data.EntityClient.EntityConnection.Open() +98
System.Data.Objects.ObjectContext.EnsureConnection() +81
System.Data.Objects.ObjectQuery1.GetResults(Nullable1 forMergeOption) +46
System.Data.Objects.ObjectQuery1.System.Collections.Generic.IEnumerable<T>.GetEnumerator() +44
System.Linq.Enumerable.ToDictionary(IEnumerable1 source, Func2 keySelector, Func2 elementSelector, IEqualityComparer1 comparer) +151
System.Linq.Enumerable.ToDictionary(IEnumerable1 source, Func`2 keySelector) +90
NopSolutions.NopCommerce.BusinessLogic.Configuration.Settings.SettingManager.GetAllSettings() +542
NopSolutions.NopCommerce.BusinessLogic.Configuration.Settings.SettingManager.GetSettingByName(String name) +121
NopSolutions.NopCommerce.BusinessLogic.Configuration.Settings.SettingManager.GetSettingValue(String name) +49
NopSolutions.NopCommerce.BusinessLogic.Configuration.Settings.SettingManager.GetSettingValueBoolean(String name, Boolean defaultValue) +54
NopSolutions.NopCommerce.BusinessLogic.Configuration.Settings.SettingManager.GetSettingValueBoolean(String name) +41
NopSolutions.NopCommerce.BusinessLogic.CustomerManagement.CustomerManager.get_UsernamesEnabled() +45
NopSolutions.NopCommerce.Web.Administration.LoginPage.ApplyLocalization() +108
NopSolutions.NopCommerce.Web.Administration.LoginPage.Page_Load(Object sender, EventArgs e) +40
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +91
NopSolutions.NopCommerce.Web.BaseNopAdministrationPage.OnLoad(EventArgs e) +44
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207
You need to have a valid connection string.
After you pass the database installation phase (when you fill in the database settings) nop commerce is keeping the database information in a file that is not within the project, you can find it within the App_Data folder in the Presentation\Nop.Web\App_Data\ named Settings.txt, update it if you need and run the application again.
You need to have a valid connection string for the NopCommerce database in web.config, and you need to ensure that it gets read.
At Application_Start in global.asax NopCommerce reads in the connection string and injects it into the business logic DLL. If that doesn't happen, the data access layer (in the business logic DLL) won't be able to open a connection and you'll get the error you just posted. I suggest check web.config and global.asax; if both look good put a breakpoint in Application_Start.
The connection string is not held in the web.config file in nopcommerce... it is in the ConnectionStrings.config file. You might want to check for that file and copy it over if it is not there or put your connection string in there if the file is there and the string is not.