Tuesday, March 20, 2012

ASP .NET Web Site Administration Tool Problem

Hi,

I have a problem when I use ASP .NET Web Application Administration tool. When I click the Security tab, I receive following message

"There is a problem with your selected data store. This can be caused by an invalid server name or credentials, or by insufficient permission. It can also be caused by the role manager feature not being enabled. Click the button below to be redirected to a page where you can choose a new data store.

The following message may help in diagnosing the problem:Unable to connect to SQL Server database."

In the same page, there is a button to go to Provider section. I clicked it, and I went to the Provider page. There, there were two links, which were: "Select a single provider for all site management data" and
"Select a different provider for each feature (advanced)". I clicked the earlier, and I was redirected to a page to select provider. There, there was a link, I clicked it and I receive following message:

"

Provider ManagementCould 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.

"

After reading this message, I opened Command Prompt and went to C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727. There, I ran the aspnet_regsql command, and then ASP .NET SQL Server Setup Wizard was displayed. In the first page of this wizard I chose "Configure SQL Server for application services" and then I clicked "Next" button. In the second page I left all fields as they were and then I clicke"Next". In the third page I only clicked "Next" and then some process ran. Finally, in the last page I received following message:

"

Setup failed.

Exception:
Unable to connect to SQL Server database.

------------
Details of failure
------------

System.Web.HttpException: Unable to connect to SQL Server database. --> System.Data.SqlClient.SqlException: 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)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject)
at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject)
at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)
at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at System.Web.Management.SqlServices.GetSqlConnection(String server, String user, String password, Boolean trusted, String connectionString)
-- End of inner exception stack trace --
at System.Web.Management.SqlServices.GetSqlConnection(String server, String user, String password, Boolean trusted, String connectionString)
at System.Web.Management.SqlServices.SetupApplicationServices(String server, String user, String password, Boolean trusted, String connectionString, String database, String dbFileName, SqlFeatures features, Boolean install)
at System.Web.Management.SqlServices.Install(String database, SqlFeatures features, String connectionString)
at System.Web.Management.ConfirmPanel.Execute()
"

What should I do? I tried to use this administration tool on computer in my house and everything was just fine. Why do I have this problem in my office?

Hi,

It seems that you are not providing correct information about your SQL Server database on second page of that wizard. It should be properly pointing to the database which would be used by your application. When you have properly pointed it to that, it will then create some default tables and objects for you to use and enable this feature in your application.

|||

Yes, you are right! I made a mistake in step 2 of ASP .NET SQL Server Setup Wizard. Recently, I successfully went through all the steps. However, I still can't open the Security tab in ASP .NET Web Site Administration Tool. When I open the Provider section, I still receive the message below:

"

Provider ManagementCould 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.

"

What should I do? I need to create a login functionality for my site in near future. Please help me...

|||

Hi haris101,

There, there were two links, which were: "Select a single provider for all site management data" and
"Select a different provider for each feature (advanced)". I clicked the earlier, and I was redirected to a page to select provider.

Open your machine.config and search for "localsqlserver" connection string. The default is configured to use sql server express database. So, if you are not using sql express, you need to modify this "localsqlserver" connection string or specify a new connection string for the default provider.

I suggestion you read this walk-through first:http://msdn2.microsoft.com/en-us/library/879kf95c(VS.80).aspx

Hope my suggestion helps

|||

hey haris

im having the same problem -
i can get the web site to run queries
but i cant get the website administration to connect
did you ever find out the solution??
would love to know your experience

thanks
toy

|||

I'm also having a similar problem, I tried to connect the aspnet_regsql to my sql 2005 server on the network but it keeps telling me it can't connect. and i'm not sure why that is. I already have information for my web app stored in this server so i know that it is running just fine. if anyone can help that would be great, im running the vs 2005 pro with the 2.0 framework.

Thank,

Shane S.
FDOT

|||

Bo Chen – MSFT:

Hi haris101,

There, there were two links, which were: "Select a single provider for all site management data" and
"Select a different provider for each feature (advanced)". I clicked the earlier, and I was redirected to a page to select provider.

Open your machine.config and search for "localsqlserver" connection string. The default is configured to use sql server express database. So, if you are not using sql express, you need to modify this "localsqlserver" connection string or specify a new connection string for the default provider.

I suggestion you read this walk-through first:http://msdn2.microsoft.com/en-us/library/879kf95c(VS.80).aspx

Hope my suggestion helps

Thanks Bo! You are right!Yes

For others who experience the same problem like mine, all you have to do is modify machine.config file in ...\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG (this is the default location). Scroll down until you find

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

What I did is changing the connection string to "Data Source=IT-HARIS\SQLEXPRESS;Integrated Security=True" since "IT-HARIS\SQLEXPRESS" is my SQL Server name and I use windows authentication to log on to this server. I hope this works for you too.


Best regards,

Haris

No comments:

Post a Comment