Monday, April 28, 2008

ASPNETDB Problem: Unable To Connect To Sql Server Database

Sometimes trying to implement security in website using website administration tool this error may occurred by saying “Unable to connect to sql server database”. Before going to see the problem we need to discuss about how to create administrative user.

To create an administrative user

Run the web site once before proceeding. This ensures the initialization of the Membership and Roles databases.

In the Website menu, click ASP.NET Configuration.

Click the Security tab.

When first time showing this error I created ASPNETDB database in sql server database using regsql utility in windows\\Framework\v2.0\50727 and now can see the ASPNETDB database in sql server. But now also I can see the same error as “Unable to connect to Sql server database”.

Then I tried to connect the application with the server. Now no problem in connecting to sql server database also. From the study to solve this error I realized some causes to occur this error.

Possible causes of this error are not giving role manager enabled correctly

In the web.config we need to put enable rolemanager enabled as true. For your reference I am giving my working web.config as giving in the



After giving the in the web.config if shows that error you may not give the connection correctly

To correct this Choose Data Store" button and go to “Provider” tab and click on to single provider. In the next page only one option remaining "AspNetSqlProvider". Select this
And click “Test” link.

Hope it will work fine. If any any “SQLExpress database file auto-creation error:” occurs Pls check that you have installed SQLEXPRESS database and
Its service is running correctly.

No comments: