Saturday, February 25, 2012

Multiple servers

Hi All,

I have recently published a website to our webserver and i get a sql error. We have a webserver that does not have sqlserver on it and and our database server which does. i have used the configuration utility to to setup my users and roles which created the ASPNETDB in my local App_Data folder. Is there a way to copy this database to our database server and change the references so the site refers to the new instance on the database server as apposed to the local instance when a user logs in?

Thanks

Bryan

Are you storing the database connection information in the web application's web.config file? Or did you hard-code it into each sql command?

|||

all my other connections are stored in the webconfig. But as for the ASPNETDB.mdf connection string i have no idea where it is stored by default. Does it matter if there is no sql server on the pc that the site resides on. To my knowledge it does, so i need to find away to have the database on the database server and the site on our webserver. I dont know if i am making myself clear... if you create a simple site with a login.aspx with a login control and a default.aspx with a simple "HELLO" on it and choose ASP.net configuration web utility and setup some users and roles, it created a folder called App_Data where the ASPNETDB database is stored.

Now if this project was a piece of electornic equipment seperated into distinct pieces, i would like to remove the database piece from where it is in my application and physically move it to another geographical place namelly my other server (database server), but if i remove it totally, clip all the wires and remove it then my equipment (website) does not work correctly. So what i want to do is to extend the cables so that they are able to reach the other server (databse server) so my equipment (website) still works fine, just with the extended cable ( some sort of connection string stored somewhere! ) :-) kind of a dumb ass analogy, but im sure you get what I mean now.

I dont know if i am missing something or the only person that has done something like this but all i do is create a simple website, which works fine on my pc, and deploy it and the login doesnt work...

ANY suggestions will be greatly appreciated, ive been pulling my hair out for almost 2 days now trying to figure this out.

thanks for all the help

Bryan

|||

Hello,

The solution was: mounted the default sql serverdatabase (ASPNETDB) on our database server and added a connectionstring in the webconfig to point to it. what i had to do was remove theconnection string and then recreate it as follows

<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="DataSource=CORE;Initial Catalog=ASPNETDB;Persist Security Info=True;UserID=user;Password=password" providerName="System.Data.SqlClient"/>

this sorted out all my issues.

Thanks

Bryan

No comments:

Post a Comment