Click here to Skip to main content
13,046,773 members (56,981 online)
Rate this:
Please Sign up or sign in to vote.
Can I use Sql Server Database file in VS 2010 with SQL server 2008 r2 Developer Edition instance? Because every time I tried to add a database file to the VS solution to App_Data (which is an ASP.Net) folder it creates an error saying that "A network related error or instance related error occurred while establishing a connection to SQL Server".

I have googled with every possible scenarios but unfortunately I cannot find the fault. I even changed the SQL Server 2008 R2 Developers' TCP/IP and other network configuration but no use of them! This is very critical to me!
Posted 26-May-13 1:21am
Basmeh Awad 26-May-13 7:54am
have you gone through this..
RedDK 27-May-13 15:36pm
Is there any chance that this "VS solution" has compiled and been published and is now residing in inetpub on C:\ drive of the development box on which it's running/throwing errors? Because if it is, the directory permissions and/or configuration might not be right.

To see if it is resident, check in "Computer Management" and under the "Services and Applications" tab select "Internet Information Services(IIS) Manager". There's even a chance IIS isn't enabled yet on the box which means IISM will be a no show; in which case run "Programs and Features" then "turn on" (Add Feature) in "Features" ... etc

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1


I do, all the time.
But that probably isn't the problem you are having. I think you are trying to use things wrongly.

When you talk about the App_Data folder, you are talking about a website based solution, so the chances are that there are several possible problems, and it is entirely possible that you are meeting them all...

The first is that the connection string to SQL server is very, very likely to be completely different for your production and development environments. Normally, the development works on a local (or local-to-the-LAN) instance of SQL server, which is kept separate from the production system. Check that the connection string you are using refers to the production instance, which is likely to require log in rather than the simpler windows authorisation that development normally uses. Also check that the login details are correct for the production server.

The second is that in production, the SQL Server and the Web Server are very likely to be separate PC's: so it is very, very unlikely that the SQL server instance can access any files in the web site folder hierarchy - these are not normally shared!

The third is that even if they two are on the same machine, the SQL server instance runs under a different user id, which is unlikely to have any permissions to access or create files in the website folder structure.

So, start by looking at the obvious, and work your way down: you don't want to store SQL files in a website folder anyway...
Chiranthaka Sampath 27-May-13 0:17am
I have done that in SQL Server Express 2008 that comes with VS 2010 and it didn't give the error that previously displayed. Then what is the reason for that pal!

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 27 May 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100