Click here to Skip to main content
15,902,198 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have three projects 1st is Financial.Asst.core, 2nd is Financial.Asst.Data and 3rd is Financial.Asst.Web.

in first project's App.config not have any connection string. in second projects App.config has below connection string.

<div class="op">Quote:</div><connectionStrings>
    <clear />
    <add name="DefaultConnection" connectionString="Data Source=DESKTOP-J97B0AI;Initial Catalog=dada;Integrated Security=True" providerName="System.Data.SqlClient" />
  </connectionStrings>


and third project's web.config file has below connection string.

<connectionStrings>
    <add name="DefaultConnection" connectionString="Data Source=.\sqlexpress;Integrated Security=true;Initial Catalog=DESKTOP-J97B0AI;" providerName="System.Data.SqlClient" />
  </connectionStrings>


So, I am keep trying to run the solution then always getting following error.

Quote:
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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)


so guys please help me to prevent from this issue.

What I have tried:

where i Enabled the sqlserver and tcpIp services.
Posted
Updated 26-Sep-17 22:32pm

1 solution

We can't help you: your connection string is at fault. It may be that the SQL Instance is wrong, it may be it isn't configured for remote connections, it may be that it just doesn't accept Windows Identification (via Integrated security) but needs a "proper" SQL username and password combination (the best solution, as the user can have his access restricted to just what he needs to do the job and no more). It could be the database doesn't exist on that server. We can't tell.

Have a look here: Simple SQL Connection String Creation[^] - it may help you create a strign that you can use.
 
Share this answer
 
Comments
Dawood507 27-Sep-17 4:36am    
its a code first approach so database not have in sql. it will generate by code only

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900