I'm developing asp.internet mvc2 application and that i use asp.internet membership provider which utilizes ASPNETDB.mdf database. I've also my very own database and today I question how you can upload these 2 databases to server? Must I upload them as .mdf file or must i use SQL server? I favor using SQL server and when someone knows the least method to convert and upload these 2 databases it might assist me to a great deal.
Thanks ahead of time,
Funny I simply finished doing exactly the same factor. The fundamental steps are the following:
- From Visual Studio, load your .mdf and select "publish to provider" to create a .sql file.
- Open SQL Management Studio, open an association for your database and load the sql file. Give a "use yourdbname" on the top to be output the tables for your database, then run it.
- Now you will have the full table structure. What remains would be to modify web.config to see the brand new tables:
First the membership provider:
<membership> <providers> <clear/> <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=18.104.22.168, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a " connectionStringName="ConnectionStringLoginInfo" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression="" applicationName="/" /> </providers> </membership>
The role provider:
<roleManager enabled="true"> <providers> <clear/> <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=22.214.171.124, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a " connectionStringName="ConnectionStringLoginInfo" applicationName="/" /> </providers> </roleManager>
And finally the WebPart provider, if you are using it:
<webParts> <personalization defaultProvider="SqlDatabaseProviderDRDBLoginInfo"> <providers> <clear/> <add connectionStringName="ConnectionStringLoginInfo" type="System.Web.UI.WebControls.WebParts.SqlPersonalizationProvider" name="SqlDatabaseProviderDRDBLoginInfo"/> </providers> </personalization> </webParts>
Within this example I known as the bond string
ConnectionStringLoginInfo, but whatever take your pick, make certain you place it within the connection strings part. Not gonna paste this too :)
All of this required me a lot more than I choose to say, however when I saw my application working perfectly using the Application_Data folder erased, which was quite as soon as!
Your easiest choice for a located solution (i.e. your hosting plan isn't a Vps) would be to generate SQL scripts of the database, conveying those to *.sql files after which run them inside your located SQL connection.
I'd normally connect with my web host's SQL instance using SQL Server Management Studio and only open or paste within the scripts produced by my local copy.
Based on whether your internet host offers the service, you could also have the ability to make use of the "Publish to provider..." option in Visual Studio.