matthewrenze / clean-architecture-demo

A sample app for my online course "Clean Architecture: Patterns, Practices, and Principles" in .NET Framework 4.8
BSD 3-Clause "New" or "Revised" License
1.03k stars 483 forks source link

How to create the database used in the demo #12

Closed Prutpan closed 3 years ago

Prutpan commented 3 years ago

When running the demo app and going to for example the 'Customers' page. I get the following error: 'A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)'

matthewrenze commented 3 years ago

Prutpan,

Based on this error message, I'd recommend checking two things:

  1. Verify that you have SQL Server installed on your machine
  2. Verify that the connection string in the Web.config file is set appropriately for your SQL server instance

The Web.config file is found in the Presentation folder: https://github.com/matthewrenze/clean-architecture-demo/blob/master/Presentation/Web.config

Here's what the connection string is currently set to:

<connectionStrings>
    <add name="CleanArchitecture" connectionString="Data Source=(local);Initial Catalog=CleanArchitecture;Integrated Security=true" providerName="System.Data.SqlClient" />
</connectionStrings>

Here are some example SQL Server connection strings for various situations that might be helpful: https://www.connectionstrings.com/sql-server/

Please let me know if this resolves the issue you're having or if you need any other assistance.

Thanks!

Matthew

Prutpan commented 3 years ago

Matthewrenze,

Thanks for your reaction. The solution you offered resolved the issue! I had to check my connection string.

Greetings, Prutpan