Sql Server, C#

By karatj ·
i've created an SQL Express Database within my C# program When i try to run the program i get an error message that says:

"An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)"

pls if any ideas it would be greatly appreciated

This conversation is currently closed to new comments.

3 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

Could be several things that

by Tony Hopkinson In reply to Sql Server, C#

Can you connect to it from the management studio?
Another tool you get is the Surface Area Configuartion tool. Among other things it sets whether the server can receive connections and what protocols can be used.

For issuing a Craete Database command on my instance of express , I would have expected the connection string to be
"server=localhost"; database=master; security = "SSPI"
or close anyway.

Collapse -

When connecting from web application...

by drpesic In reply to Sql Server, C#

Recently we had same issue, and it was happening only when u try to connect through an AP.NET web service, without an windows user credentials. Problems was not in the settings on the server or the firewall or anything like that. In the end, it appeared that owner of the call (ASPNET user in this case) did not have the proper security rights to verify location of the sql server with the name mentioned in the connection string. Once we used direct IP instead, it worked just fine.

Back to Networks Forum
3 total posts (Page 1 of 1)  

Related Discussions

Related Forums