Lombiq/Orchard-Training-Demo-Module

Error when I try to "Configure" a new Orchard OSOCE Web App with Sql Server in localhost (OSOE-788)

MarGraz opened this issue · 6 comments

Hi,

I successfully configured a new Orchard (OSOCE) web app using the SQLite database.

Now, I cloned the OSOCE repository again into a new folder, to use a new and empty database in my local SQL Server, and in the configuration, I used this connection string: Server=localhost;Database=OrchardCoreLearningPath;User Id=ImALocalhostAdmin;Password={alphanumeric-passw} but I always get the error:

"The provided connection string is invalid or the server is unreachable."

I'm able to connect to my database using SQL Server Management Studio and "localhost", I'm not using SQL Express, my user has rights to manage the database, and I'm using the standard port.
Because I started the web app with Ctrl + F5, to run the first time site configuration, I doesn't have any log in my Visual Studio Output window.

I don't understand what I'm doing wrong.

Thank you

Jira issue

I also made this little Console App to check if it was able to connect, and it works.

using System.Data.SqlClient;

Console.WriteLine("Test DB localhost connection");

var connectionString = "Server=localhost;Database=OrchardCoreLearningPath;User Id=ImALocalhostAdmin;Password={alphanumeric-passw}";

try
{
    using (var connection = new SqlConnection(connectionString))
    {
        connection.Open();
        Console.WriteLine("Connection successful");
    }
}
catch (Exception ex)
{
    Console.WriteLine("An error occurred while connecting to the database, exc message:");
    Console.WriteLine(ex.Message);
}

Thanks to this issue, I discovered that adding Encrypt=false at the end of my connection string makes it work!

So the working connection string looks like: Server=localhost;Database=OrchardCoreLearningPath;User Id=ImALocalhostAdmin;Password={alphanumeric-passw};Encrypt=false

I suggest changing the example in the description to include Encrypt=false at the end of the connection string.

image

@MarGraz That is actually coming from Orchard Core itself and not from Lombiq.TrainingDemo but we will check into this.

Yeah, this is coming from Orchard Core, but it would be indeed useful to document (though using Encrypt=false is only suitable for local development). Could you open an OC issue please? https://github.com/OrchardCMS/OrchardCore/issues/new/choose

Thanks!