ERROR: Provider Management - Could not establish a connection to the database.

T

Ted

In WSAT, I get the following error when trying to set up my provider:

Could not establish a connection to the database.
If you have not yet created the SQL Server database, exit the Web Site
Administration tool, use the aspnet_regsql command-line utility to
create and configure the database, and then return to this tool to set
the provider.

On Windows XP Pro, I am using MS Visual Studio 2005, and I am using
the developer's edition of MS SQL Server 2005 and NOT MS SQL SERVER
2005 EXPRESS!

I used the aspnet_regsql tool and it did create the database in SQL
Server 2005 without difficulty. If I open the instance of SQL Server
2005 I used, I can see the database it created.

How to I tell WSAT to use SQL Server 2005 instance of SQL Server 2005
Express?

I assume there is a connection string hiding somewhere, but where is
it. It is certainly not in the default web.config file. That file is
mostly empty! In fact, the file Visual Studio created for me contains
only the following:

<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/
v2.0">
</configuration>

What I will aim for, eventually, is to specify the machine and
instance name (or even to specify another database product such as
MySQL or PostgreSQL, if that is possible - MySQL provides .NET, but I
haven't found that for PostgreSQL). Can any data provider be used to
support the login process?

Thanks

Ted
 
G

Guest

Ted,

If you dont see entries for <connectionStrings> and <membership> settings in
you app's web.config then check your machine.config file. If not there, then
check for a web.config at your root web level.

Your machine and root web configs are probably located at:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\

You can either change your settings in the machine.config or override them
for just your app in your application's web.config. If you decide to
override the defaults by using your web.config then also make sure to clear
the providers settings and specify a value for the applicationName tag.

In your web.config...

<connectionStrings>
<add
name="MyAspnetDB"
connectionString="data source=.\SQLEXPRESS;Integrated
Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true"
providerName="System.Data.SqlClient"
/>

</connectionStrings>

<system.web>
<membership>
<providers>
<clear />
<add name="AspNetSqlMembershipProvider"
type="System.Web.Security.SqlMembershipProvider, System.Web,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="MyAspnetDB"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="true"
applicationName="MyApplicationName"
requiresUniqueEmail="true"
passwordFormat="Hashed"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="7"
minRequiredNonalphanumericCharacters="1"
passwordAttemptWindow="10"
passwordStrengthRegularExpression="" />
</providers>
</membership>
</system.web>

Hope this helps,
Jason Vermillion
 
T

Ted

Ted,

If you dont see entries for <connectionStrings> and <membership> settings in
you app's web.config then check your machine.config file. If not there, then
check for a web.config at your root web level.

Your machine and root web configs are probably located at:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\

You can either change your settings in the machine.config or override them
for just your app in your application's web.config. If you decide to
override the defaults by using your web.config then also make sure to clear
the providers settings and specify a value for the applicationName tag.

In your web.config...

<connectionStrings>
<add
name="MyAspnetDB"
connectionString="data source=.\SQLEXPRESS;Integrated
Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true"
providerName="System.Data.SqlClient"
/>

</connectionStrings>

<system.web>
<membership>
<providers>
<clear />
<add name="AspNetSqlMembershipProvider"
type="System.Web.Security.SqlMembershipProvider, System.Web,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="MyAspnetDB"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="true"
applicationName="MyApplicationName"
requiresUniqueEmail="true"
passwordFormat="Hashed"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="7"
minRequiredNonalphanumericCharacters="1"
passwordAttemptWindow="10"
passwordStrengthRegularExpression="" />
</providers>
</membership>
</system.web>

Hope this helps,
Jason Vermillion












- Show quoted text -

Hi Jason,

Thanks. I have been able to make some progress, but I am not quite
there yet. Here is the error message I get now:


A connection was successfully established with the server, but then an
error occurred during the login process. (provider: Shared Memory
Provider, error: 0 - No process is on the other end of the pipe.)
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: A connection
was successfully established with the server, but then an error
occurred during the login process. (provider: Shared Memory Provider,
error: 0 - No process is on the other end of the pipe.)

Source Error:

An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace
below.


I have not providedd the stack trace here, but my guess is that I have
misconfigured the provider to expect to connect to SQL Server using
pipes and I have the server configured to connect using TCP/IP. WHen
I connect to the database, using SQL Server authentication and the
credentials I created for my ASP projects, and using my other
development tools, I connect easily. Here is what I have now in the
machine config file:

<connectionStrings>
<add name="LocalSqlServer" connectionString="data
source=.;Integrated Security=SSPI;User ID=aspuserid;Password=my-
password;User Instance=true" providerName="System.Data.SqlClient" />
</connectionStrings>


and ...

<membership>
<providers>
<add name="AspNetSqlMembershipProvider"
type="System.Web.Security.SqlMembershipProvider,
System.Web, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="LocalSqlServer"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="true"
applicationName="/"
requiresUniqueEmail="false"
passwordFormat="Hashed"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="7"
minRequiredNonalphanumericCharacters="1"
passwordAttemptWindow="10"
passwordStrengthRegularExpression="" />
</providers>
</membership>


SO, are these the sections of the config file that determines whether
the ASP app authentication pages try to use pipes or TCP/IP to connect
to the database back end? If so, what did I get wrong. If not, where
do I look and what do I change? Is it the .NET framework that decides
this or IIS?

Can I use other RDBMS backends? I have installed MySQL and
MySQL's .NET add-on, and have already used it to connect simple
ASP.NET web pages to a database I maintain in MySQL, and that on a
different machine from my development machine. If I can, will
aspnet_regsql work with MySQL or is it SQL Server only? Alas, the
books I have don't talk about this and I have not yet found the right
place in the documentation that came with Visual Studio 2005 to find
these details.

Thanks again.

Ted
 
T

Ted

Hi Jason,

Thanks. I have been able to make some progress, but I am not quite
there yet. Here is the error message I get now:

A connection was successfully established with the server, but then an
error occurred during the login process. (provider: Shared Memory
Provider, error: 0 - No process is on the other end of the pipe.)
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: A connection
was successfully established with the server, but then an error
occurred during the login process. (provider: Shared Memory Provider,
error: 0 - No process is on the other end of the pipe.)

Source Error:

An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace
below.

I have not providedd the stack trace here, but my guess is that I have
misconfigured the provider to expect to connect to SQL Server using
pipes and I have the server configured to connect using TCP/IP. WHen
I connect to the database, using SQL Server authentication and the
credentials I created for my ASP projects, and using my other
development tools, I connect easily. Here is what I have now in the
machine config file:

<connectionStrings>
<add name="LocalSqlServer" connectionString="data
source=.;Integrated Security=SSPI;User ID=aspuserid;Password=my-
password;User Instance=true" providerName="System.Data.SqlClient" />
</connectionStrings>

and ...

<membership>
<providers>
<add name="AspNetSqlMembershipProvider"
type="System.Web.Security.SqlMembershipProvider,
System.Web, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="LocalSqlServer"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="true"
applicationName="/"
requiresUniqueEmail="false"
passwordFormat="Hashed"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="7"
minRequiredNonalphanumericCharacters="1"
passwordAttemptWindow="10"
passwordStrengthRegularExpression="" />
</providers>
</membership>

SO, are these the sections of the config file that determines whether
the ASP app authentication pages try to use pipes or TCP/IP to connect
to the database back end? If so, what did I get wrong. If not, where
do I look and what do I change? Is it the .NET framework that decides
this or IIS?

Can I use other RDBMS backends? I have installed MySQL and
MySQL's .NET add-on, and have already used it to connect simple
ASP.NET web pages to a database I maintain in MySQL, and that on a
different machine from my development machine. If I can, will
aspnet_regsql work with MySQL or is it SQL Server only? Alas, the
books I have don't talk about this and I have not yet found the right
place in the documentation that came with Visual Studio 2005 to find
these details.

Thanks again.

Ted- Hide quoted text -

- Show quoted text -

OK, now I am completely confused. I do not understand!

I changed the following, having read that integrated security uses
Windows authentication to connect to SQL Server and I require the app
to use SQL Server authentication.

Integrated Security=false

And I changed the following in response to an error message I received
(to the effect that the user instance flag is not supported with this
provider) once I made the above change.

User Instance=false

Once I made these two changes, everything works fine. How what do the
changes I made have to do with the error I describe in my previous
post about the application not being able to use pipes to talk to SQL
Server? And why does connection using integrated security fail when I
can use it in MS SQL Server Configuration Management (pipes are
disabled on my installation of SQL Server, so integrated security must
work fine over the local TCP/IP stack). I have, in fact, enabled my
installation of SQL Server 2005 to use either, and, in all my other
application projects, I can use either form of authentication without
a problem. In my other applications, in fact, I create an application
specific configuration file to govern how the application connects;
something the MIS of the client can edit as he wishes.

Can anyone shed light on why I encountered problems here and how the
errors I saw are related to the changes I made? I am not confortable
with a situation in which a change I made appears to fix something
when I do not understand WHY!

Thanks

Ted
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,007
Latest member
obedient dusk

Latest Threads

Top