Using LINQ changing database from SQL Server 2008 R2 to SQL Server 2008
I've completed my webpage on my home computer and ready to upload it.
However I'm getting this error:
A network-related or instance-specific error occurred while establishing a connection to SQL 开发者_如何学CServer. 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)
I know the connection string is correct. And I run a few different pages so I can connect to the other databases without problem.
This is the fist time I have used LINQ and I thought perhaps there was a setting it made that I need to change? LINQ is used in my DAL which is separate to the database, its just stored as DLLs in my bin folder...
My development server uses SQL Server 2008 R2 Express and my live server uses SQL Server 2008
I created database scripts to create the database. so I just ran them to downgrade the webpage.
Also In my DAL I just do this:
AHDBcontext db = new AHDBcontext(connectionstring);
var whatever = from s in suppliers
select s;
I always set connection string from the web.config file.
Any ideas?
- Check the connection string.
Another way is following.
Go to Start Up => Microsoft Sql server 2008 => Configuratiuon Tools => Sql Server Configuration Manager
Check the Enabled status for client protocol.
restart the Browsing and other necessary services.
精彩评论