I created a model from DbContext and stored connection string in the app config file. It runs perfectly on my PC. However when I deploy it to another PC, it throws an exception
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 )
public class FoodIndustryContext:DbContext
{
public FoodIndustryContext (): base("name = FoodIndustryContextDB") { }
public DbSet<Industry> Industries { get; set; }
public DbSet<Purchase> Purchases { get; set; }
}
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<connectionStrings>
<add name = "FoodIndustryContextDB"
connectionString = "Data Source =.;Initial Catalog = FoodIndustryDemo;Integrated Security = true"
providerName = "System.Data.SqlClient"/>
</connectionStrings>
</configuration>