Cannot connect to blog db on local test

Topics: ASP.NET 2.0, Controls
Dec 22, 2010 at 5:28 PM

Hello to all, is nice to be part of the community of CodePlex and BlogEngine from now on.

I have tried to run the BlogEngine webapp on my local computer creating the Database with db script MSSQLSetup1.6.0.0.sql, setting the Virtual Directory on IIS accordingly and changing the ConnectionString entry on Web.Config on the line:

<add name="BlogEngine" connectionString="Data Source=.\MSQL2005;User ID=sa;Password=1234;persist security info=False;initial catalog=Test_BlogEngine;" providerName="System.Data.SqlClient"/>

When i try to login using the Admin user information within the page login.aspx i get this error:

"The connection attempt wasn't succesfull. Try again."

I have ensured that the connection is correct using a test aplication to retrieve some data of the BlogEngine newly created DB and all works fine.

Am I missing something on the setup?.

Would be cool if someone could help me to make this work.

Thank you very much.

RC.

Coordinator
Dec 22, 2010 at 8:51 PM

Even before trying to log in, when you pull up the blog, do you see any posts, or any data?  A new installation of BE has an introductory post of "Welcome to BlogEngine 1.6" (for example).

If you do see any data/posts, this would mean that the connection to the DB is good.

Dec 22, 2010 at 9:16 PM

Hi Ben.

I do see the initial post on the URL:

http://localhost/BlogEngine.Web/

Then I click on the Login option on the upper part of the same page and it redirects me to:

http://localhost/BlogEngine.Web/login.aspx

I enter admin both as username and password and the error i commented previously shows up.

Another strange thing that happens is that just to test the database connection i changed the introductory title of the Welcome post on the table be_Posts and whenever i refresh the page where the initial post should show up using Ctrl+F5 to remove cached data. I still see the old information.

Tried also changing the password to 1234 for the user Admin in the be_Users table before and after the problems ocurred, typed it in the Login fields and the problem persisted.

Please give me some workarounds if it is possible,

Thanks a lot for your help.

cR.

Coordinator
Dec 23, 2010 at 1:18 AM

When you manually change data in the DB like you did, it's normal for the old data to appear.  This is because BE caches all the data, and doesn't re-read the DB ... and it's unaware you made a manual change.

If you restart the blog, then it will read the data from the DB again.  You can restart the blog by making any change to the web.config file in the root folder (add a space, etc).

In your web.config file, what is the "defaultProvider" for the <membership> tag?  It looks like:

<membership defaultProvider="DbMembershipProvider">

Is your defaultProvider "DbMembershipProvider" or "XmlMembershipProvider"?  If it's DbMembershipProvider, then it will use the be_Users table to look up the user account.

And if your defaultProvider is DbMembershipProvider, I would reset the password to an empty string:

UPDATE be_Users SET [Password] = ''

And then restart the blog by making any change to the web.config file ... i.e. add a space in the file, etc.  This will clear out passwords that are probably cached in memory.  And then, try logging in using the default password of "admin".  So if you have a user in be_Users named "Admin", then try logging in under "admin" for the username and "admin" for the password.

Dec 23, 2010 at 2:37 PM

Hi Ben.

I made it work already. Updated the web.config file setting up my local server name and overwrote it, reset the Admin password and changed the location of the Blog.Engine files because i started getting an access denied error upon the web.config file.

Now its working well. I am actually using this application as a way to improve my coding practices, i think it will serve as a great help.

Thanks a lot for your help and Season Greetings!.