Click here to Skip to main content
15,945,119 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to publish my project in IIS but i get this 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: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details.
) 


I am using SQL Server 2017

What I have tried:

and this is my connection string :

   <connectionStrings>
   <add name="DefaultConnection"

  connectionString="Data Source=DESKTOP-LBLR0NH\SQLEXPRESS;Initial Catalog=aspnet-RES-20190212124018;Integrated Security=False; User Id=Zahra; password=12345" providerName="System.Data.SqlClient" />


</connectionStrings>


I try to solve but it is not work i hope any one help me

Thank you
Posted
Updated 9-May-19 3:51am
Comments
Kornfeld Eliyahu Peter 5-May-19 4:48am    
The error means that some SQL server can not be found... According to your connection string you are using a local SQL server (and SQL express version)... There is a chance that the publish target does not know you local computer... It is also possible that you did not opened the requested ports on you local firewall...
Member 14317227 5-May-19 6:35am    
Thank you for your answer ,, so what i can do now?
Kornfeld Eliyahu Peter 5-May-19 6:39am    
Check the computer you are publishing on, see if it can connect he other computer with the SQL on it...
Member 14317227 5-May-19 6:41am    
how i can do that?

Are you publishing locally? I NEVER put a machine name, I put localhost because it's at least somewhat portable. If you're not publishing locally, it's because the DB doesn't exist there
 
Share this answer
 
Comments
Member 14317227 5-May-19 6:34am    
yes i publish locally .. so what i can do ?
Christian Graus 5-May-19 18:17pm    
Your post makes no sense. You say you can't publish but report issues with a connection string. Does the connection string work in Management Studio? Can you change it or remove it and the publish works?
Hi , problem with ur db connection , check ur connection string source,catlog,username and password,if web application and sql server in same machine, then use localhost or ip address or simply single dot, Check ur sql instance name also
e:g

Data Source=192.168.0.1\SQLEXPRESS

Data Source=(localhost)\SQLEXPRESS

Data Source=.\SQLEXPRESS


Check sql server browser service running or not , use port to access from other pc if web and sql different machine,port must u check with sqlservermanager.

Port : Data Source=192.168.0.1\SQLEXPRESS,1443

Regards,
Aravind
 
Share this answer
 
v2
Cross check your Datasource.
Data Source=192.168.10.25\SQLServer
 
Share this answer
 

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