asp.net MVC 4.0 membership database - asp.net-mvc-4

I'm familiar with aspnet_regsql.exe to create a membership database in asp.net web forms. but i am not aware about MVC4.0(visual studio 2012) membership. what should i do to have these membership table in SQL server management studio 2012.

The tables are created automatically the first time you try to register a user. If you want to configure a remote database, then you can use database migrations to generate a script to execute to create the tables afterwards.

Related

How to move EF migration and update database in Azure SQL DB

I have an Entity framework project created in Visual Studio 2019.
I have created a migration using Add-migration, and have updated the local SQL DB using Update-database. The changes in migration are reflected in (localdb)\MSSQLLocalDB. Everything is working as it should.
Now I want to publish my application from VS, and want the changes in my migration and local DB to move/migrate to the Azure SQL DB for use by masses.
How do I make sure after publishing, the changes have migrated to the Azure SQL DB?
Thanks,
KB
If you have access to azure database from your local just do Update-Database with azure database connection string. otherwise, you should do this somewhere in your application:
yourDbContext.Database.Migrate();

Asp.Net MVC development with Visual Studio LocalDB

I am currently studying software development and for a project I will be developing a database driven application in Asp.Net MVC. I am completely new to MVC but have experience in Asp.Net Web Forms.
I have done a small app using the Entity Framework Code First approach using the Local db. My question is if I start a website using the localdb can i then transfer the database to a seperate sql server database. Also if the database is not a localdb, can code first still create the tables in the seperate database as in the localdb
Thanks
Yes, definitly, you can do that.
When you want to migrate simply :
Generate script from localdb and run it on sqlserver
Create a new connection string to point to the new SQLserver database.
This should do the job:
Here is tutorial that might help you.

ASP.NET SQL Server Registration Tool Not Finding Any Databases

I am trying to use the ASP.NET SQL Server Registration Tool to setup my database for Membership Roles and ASP.NET Users however it cannot find any database when I clearly have one. I am using SQL Express, does that play any role?
What are you using for the -S (server) parameter? You must use ServerName\InstanceName. By default, SQL Server Express has an instance name of SQLEXPRESS. Therefore, most like you should be using YourServerName\SQLEXPRESS.

Visual Studio database project won't deploy to SQL Azure

I've ran into problem very similar to this. I have a .dbproj Visual Studio database project. It deploys just fine in SQL Server Express. Now I want to deploy it to SQL Azure - I change the connection parameters but deployment fails with the following text:
C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\TeamData\Microsoft.Data.Schema.TSqlTasks.targets(120,5): Error Deploy01234: The target database schema provider could not be determined. Deployment cannot continue.
Done executing task "SqlDeployTask" -- FAILED.
Is deploying .dbproj projects to SQL Azure supported? How do I make Visual Studio deploy the database into SQL Azure? What are other ways to achieve more or less the same results except recreating the database manually using Azure portal?
If you are using Visual Studio 2012, you can now create a Database project and go to Properties - set its Target Platform to SQL Azure in Project Settings tab. Also you can configure the setting for dacpac output. Use this file to import directly as a new SQL Azure database.
As far as I know, Database projects are still not supported by Windows Azure. You can deploy the project to a local SQL server and then use the "Generate Scripts" feature to port the database to SQL Azure. See this link.
An easy solution is to create the database locally and use the SQL Azure Migration Wizard to do the migration up to SQL Azure. It works very well in just a few clicks (and will fix common errors).
Database projects don't work with SQL Azure. What I do is before deploying, create a brand new database on local server (to ensure it is up to date with no dev scripts), and then sync that database to Azure with RedGate SQL Compare. I do a backup first with RedGate SQL Azure Backup.
When we first built DB projects, SQLAzure was still going through its identity crisis and didn't know what it wanted to be. ;)
DBProjects support a significant superset of capabilities vs. SQLAzure. Therefore, it's quite possible that it'll create scripts that won't run against SQLAzure.
I know that the team who took-over the DBProject tooling were looking at restricting the database project generators to output SQLAzure-compatible scripts, but I don't know how far they got or whether they decided to proceed.
I echo dunnry's suggestion above and use the SQL Azure Migration Wizard or Jeremy's and use SQL 2008 R2 and generate Azure-compatible scripts.

aspnet_regsql.exe and MVC

Can someone explain what aspnet_regsql.exe is really used for?
When I create a standard ASP.NET MVC project in VS2008 and register a user, I get the db created with corresponding asp.net membership tables etc.
This uses the SQL Server Express 2005 as standard.
The forums I have found states that aspnet_regsql.exe is used when one is migrating the created SQL Server Express db to a SQL Server, fx. to a hosting server. I am right about this?
But is this change a global change, meaning that next time I start a new MVC project or standard Win Forms project and add a db, it will use SQL Server as provider and not SQL Server Express? Or is this aspnet_regsql.exe only used on a project basis?
Like you say, the aspnet-regsql will create the tables into any (Express or not) version of SQL Server. I -think- your main question is how do you know which database you're attaching to, right? If so, then that is handled in your web.config file in the "Membership" provider area. What I do is use a SqlMembershipProvider for my development (utilizing the tables created with aspnet_reqsql) and then switch to ActiveDirectoryMembershipProvider for production.
MSDN Article on aspnet_reqsql
aspnet_regsql.exe is a utility designed to prepare a database to work with asp.net providers. These providers provide services to asp.net applications such as user membership, roles, and profile management and require a database that adhere to specific schemas.
By running this application you can alter an existing database to adhere to these schemas or create the default database for these services (aspnetdb.mdf?).
I believe that the utility might also prepare some of the intrinsics for provider usage.