Sunday, February 19, 2012

Attatching ASPNETDB to remote server

Hi there ;

I uploaded my app to host but crashed during membership activities, and i figured out it's cause of ASPNETDB.mdf that is not accessible in remote server, & it's driving me crazy.

As a solution i wanted to know :

is it possible to attatch my db in App_Data to remote server and make use of it just like before?

Please take it into concideration that i've already tried 'aspnet_regsql.exe' and the server gives me error:40 (only local access allowed ).

thanks in advance

No, for the AttacheDBFilename property, currently remote server, HTTP, and UNC path names are not supported. In other words the attached database file must be on the local disk of the SQL machine.|||

thanks lori ,

but i didn't say that i'm goin to set a http or sth alike as db File name . my problem is that my host company doesn't allow remote connections so that i can't use aspnet_regsql.exe .so i just wanted to know that if i send ASPNETDB.mdf to remote server (not necessarily to App_Date folder ) and ask admins to attach it in there, does it work just like the aspnet_regsql.exe ?so that i can then change my connectionstring to the one that my host offers after attaching.

thanks for any help

|||Sorry for misunderstandingSmile Yes, aspnet_sql has nothing to do with database connection for your website, we use aspnet_regsql.exe to create database objects in specified database which can be used for membership. So just make sure connection can be made to the remote SQL Server.|||

So i'll do it .

really thanks for the help

|||

i did that, one final job is to set LocalSqlServer to the new one in the remote server, to do so, follow steps:

ControlPanel > Administrative Tools > Internet Information Services > here choose your website's virtual directory that is somewhere under "Default Web Site"

then right click and choose Properties, on the rightmost tab named "ASP.NET" click the button named "Edit Configuration..." .

on the window that will open, you see the "LocalSqlServer" under "Connection string manager", and it's value is set to the ASPNETDB.mdf that is in the App_Data directory, click on it & edit it to point to the one that is on the remote server .

Generally for those, who aren't allowed to access the db remotely, the best job, i think, is to generate a copy of "ASPNETDB.mdf" locally (In case there is someone else that has taken the name ASPNETDB, change its name) & send it to your remote server and ask them to attach it, then, with the connection string they offer you can have sth like "ASPNETDB.mdf" working remotely.

Thanks lori for the help

No comments:

Post a Comment