Moti Mashiah
asked on
asp.net mvc
Hi Guys,
I have some issue with my default connection through web.config.
I have configured my default connection to connect my local database server and I'm getting error "Unable to connect to SQL Server database".
I have checked my server name 10 times and my database name as well, and I found all is good. also I tested from server explorer in visual studio and it works fine and connecting to the SQL server:
Here is how I'm trying to connect through web config and fail anytime:
Thanks ,
I have some issue with my default connection through web.config.
I have configured my default connection to connect my local database server and I'm getting error "Unable to connect to SQL Server database".
I have checked my server name 10 times and my database name as well, and I found all is good. also I tested from server explorer in visual studio and it works fine and connecting to the SQL server:
Here is how I'm trying to connect through web config and fail anytime:
<add name="DefaultConnection" connectionString="Data Source=localhost;Initial Catalog=Codeexample;Persist Security Info=True;User ID=sa;Password=*******;multipleactiveresultsets=True;" providerName="System.Data.SqlClient" />
Thanks ,
bring up sql config and enable tcpip and restart the sql server
ASKER
The SQL is on local machine and I can connect from any other applications.
Anyway I will try your suggestion and let you know.
Thanks ,
Anyway I will try your suggestion and let you know.
Thanks ,
ASKER
I just checked and tcp\ip is enable.
ASKER
As I said before I can connect to SQL from anywhere else.
Thanks,
Thanks,
ASKER
After I checked again I can prove that my SQL server is working fine. I telnet to port 1433 and also connected from different solution I have and all work fine.
The issue is in my web.config in connection string I'm pretty sure.
Actually, I'm really confuse as I have two connection string in same web.config and one of them work.
look at the config connectionstring. (the second one "CodeexampleEntities" is connecting with no issue ) the first connection is for user authentication and this is fail.
The issue is in my web.config in connection string I'm pretty sure.
Actually, I'm really confuse as I have two connection string in same web.config and one of them work.
look at the config connectionstring. (the second one "CodeexampleEntities" is connecting with no issue ) the first connection is for user authentication and this is fail.
<add name="DefaultConnection" connectionString="Data Source=localhost;Initial Catalog=Codeexample;Persist Security Info=True;User ID=sa;Password=*******;multipleactiveresultsets=True;" providerName="System.Data.SqlClient" />
<add name="CodeexampleEntities" connectionString="metadata=res://*/Code.csdl|res://*/Code.ssdl|res://*/Code.msl;provider=System.Data.SqlClient;provider connection string="data source=localhost;initial catalog=Codeexample;persist security info=True;user id=sa;password=******;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
solved