RE: Could not establish a connection to the database
- From: stcheng@xxxxxxxxxxxxxxxxxxxx (Steven Cheng[MSFT])
- Date: Wed, 23 Aug 2006 08:39:28 GMT
Hello Bruno,
From your description, after you installed Visual Studio 2005 and SQLServer 2005 on the machine, when creating a new ASP.NET application and use
the web admin tool to configure the ASP.NET application, you're getting the
following error, correct?
<<<<<<<<<<<<<
"Could not establish a connection to the database.
...............
Based on my experience, the problem could be caused by the following things:
1. The admin tool/ASP.NET runtime try connecting to a non-existing database
instance(according to the configured provider, membership or role manager
...)
2. The target database instance does exsits, but the current
application/'security context can not establish connection to it.
For your scenario, I noticed that you've mentioned the following installed
instances on your machine:
**My_PC_Name\Pinnacle(is this the SQL server 2005 server instance?)
**My_PC_Name\SQLEXPRESS(surely this is the SQLEXPRESS instance installed
with VS 2005)
If the above is the case, I'd like to confirm the following things with you:
1) Have you done any changes in the machine.config or your ASP.NET
application's web.config to customize any of the ASP.NET service
providers(such as membership, rolemanager ....)? Also, when using the web
admin tool, it is on which page and performing which operation did you get
the error?
2) by default in the machine.config, it contains the following default
connectionstring for all the SQL Server providers:
<connectionStrings>
<add name="LocalSqlServer" connectionString="data
source=.\SQLEXPRESS;Integrated
Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User
Instance=true" providerName="System.Data.SqlClient" />
You can check whether this is the value on your machine. And if you're
trying to use the default SQL server provider, it will use this
connectionstring to establish connection to the sqlserver instance. (if
success, it will create a aspnetdb.mdf file in your application's App_Data
sub directory).
3) If you're trying to connect to custom SQL Server database instance
instead of the default SQL express one, what custom configuration have
performed on the machine? Make sure the SQL Server instance and SQL Express
instance has been started.
In addition, for general testing, you can try the following things:
i) try creating a normal sql express mdf file in your web application's
"App_Data" folder by "Add New Item---> SQL Database" menu to see whether
you can explicitly create a sqlexpress database file
ii) are you developing the web application in VS 2005 through file sytsem
project or IIS host project? You can try both mode to see whether it
behaves differently.
iii) Here is a web article introducing how to use non-default(SQL Express)
database for ASP.NET providers, if your problem is related SQL Express, you
can use its guide to create custom provider setting against your SQL Server
2005 server instance to see whether it works.
#ASP.NET 2.0 App Service Config Issues When Not Installing Sql 2005 Express
http://aspadvice.com/blogs/plitwin/archive/2005/11/04/13590.aspx
Hope this helps. If there is anything unclear or any other information you
wonder, please feel free to let me know.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
.
- Follow-Ups:
- Prev by Date: Re: Team System Setup Failing (at or near end)
- Next by Date: Re: Team System Setup Failing (at or near end)
- Previous by thread: Unattended installation of VS2003SP1?
- Next by thread: RE: Could not establish a connection to the database
- Index(es):
Relevant Pages
|