Saturday, February 25, 2012

Problem with website and db

I am new to .NET and the Visual Web Developer Express and what not...I have created a website on my machine which works wonderfully...however, and I'm sure this is somewhere but I can't find it, I cannot get it to work on my host server...the Default page comes up, but when I try to sign in it says:

"An attempt to attach an auto-named database for file c:\hosting\webhost4life\member\harrison0801\App_Data\aspnetdb.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share."

The host support tells me to change the db name from aspnetdb to something else...I do this and when I run the site again or try to log in, I get the exact same error message...then they go on to tell me that I have to remove the LocalSqlServer in the web.config file which now looks like this:

<connectionStrings>
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="Data Source=.\SQLEXPRESS;Integrated Security=True;AttachDbFilename=|DataDirectory|aspnetdb.mdf;User instance=true;" providerName="System.Data.SqlClient" />

<add name="Example" connectionString="Data Source=.\SQLEXPRESS;Integrated Security=True;AttachDbFilename=|DataDirectory|example.mdf;User instance=true;Initial Catalog=example;" providerName="System.Data.SqlClient" />

</connectionStrings>

Of course this isn't working either...otherwise I would off playing on my server, and not posting here. Also, when I set up all the roles, users, and what not on my machine...does this carry over to the host machine?

Desperately needing massive help here...

Not a DBA and no expert in .NET

Thank you very much in advance,

Darren

Rename the .mdf file from aspnetdb.mdf to harrison0801.mdf and change your connection string to

<add name="LocalSqlServer" connectionString="Data Source=.\SQLEXPRESS;Integrated Security=True;AttachDbFilename=|DataDirectory|harrison0801.mdf;User instance=true;" providerName="System.Data.SqlClient" />

|||

Okay...renamed the ASPNETDB.MDF and changed the config connection string to the above...hit CTRL F5 to run it...and guess what magically appeared? ASPNETDB without regard to the one I just changed the name on.

Also, when I run the ASP NET Configuration utililty in the VWD...walks me through all the roles, users, etc...it loads all that info into the ASPNETDB...is there something in the default config for the DB creator that can be changed? Perhaps this is something that the ASPNET creators can work out...maybe like allow the developers to name there own DB in the process of creating websites? Would be nice...less of a headache.

No comments:

Post a Comment