I have created a .NET Standard C# project and a SQL database in my LocalDB server (LocalDb)\MSSQLLocalDB. I have tried to configure the connection string in the project web configuration file but in runtime the connection to SQL server is not succeeded. How can I configure a local DB server in my project config file?

This is the connection string configured in my project web.config:

    <add name="iPark.Database.Properties.Settings.iParkConnectionString"
         connectionString="Data Source=(LocalDb)\MSSQLLocalDB;Initial Catalog=iPark;User ID=iParkUser;Password=iParkPassword1"
         providerName="System.Data.SqlClient" />

When I try to access the database, the following error occurs:

enter image description here

Relative to the database, I've created the user iParkUser with authentication type "SQL Server Authentication". I can login to the server and the database with the user and its roles are the following:

  • db_owner
  • db_reader
  • db_writer
  • Would we be able to get the full connection string you are using? What is the error message that you are getting? It could be a permissions issue for the account running the application, an issue with the driver. Are you able to connect to the same SQL instance from something else like SSMS? – Kirk Saunders Jul 2 at 20:30
  • Yes, I’m traveling and I haven’t my pc right here but tomorrow in the monrning, I share that informations. Thanks in advance. – pncsoares Jul 2 at 21:31
  • Comment updated. – pncsoares Jul 4 at 11:54
  • Are you currently working on this web application from your local machine? (I am assuming this is yes, but for my sake I want to ask) Is the exact same value (special characters and all) used in your SSMS instance the same value you are using for your SQL Connection in the config file? – Kirk Saunders Jul 5 at 14:17
  • Yes, it is! Ahahah I’m working on my local machine with a local website. I have a hostname assigned to in my hosts file. – pncsoares Jul 5 at 18:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.