aspnet_regsql.exe and MVC - sql-server-2005

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.

Related

asp.net MVC 4.0 membership database

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.

Can't Export Data-tier Application for Azure

I am trying to create a .bacpac file of my SQL 2012 database.
In SSMS 2012 I right click my database, go to Tasks, and select Export Data-tier Application. Then I click Next, and it gives me this error:
Error SQL71564: Element Login: [myusername] has an unsupported property IsMappedToWindowsLogin set and is not supported when used as part of a data package.
(Microsoft.SqlServer.Dac)
I am trying to follow this tutorial so that I can put my database on Azure's cloud:
http://blogs.msdn.com/b/brunoterkaly/archive/2013/09/26/how-to-export-an-on-premises-sql-server-database-to-windows-azure-storage.aspx
How can I export a .bacpac file of my database?
SQL Azure doesn't support windows authentication so I guess you'll need to make sure your database users are mapped to SQL Server Authentication logins instead.
I found this post referenced below which seems to answer my question. I wonder if the is a way to do this without having to delete my user from my local database...
"... there are some features in on premise SQL Server which are not
supported in SQL Azure. You will need to modify your database before
extracting. This article and several others list some of the
unsupported features.
This blog post explains how you can use SQL Server Data Tools to
modify your database to make it Azure compliant.
It sounds like you added clustered indices. Based on the message
above, it appears you still need to address TextInRowSize and
IsMappedToWindowsLogin."
Ref. http://social.msdn.microsoft.com/Forums/fr-FR/e82ac8ab-3386-4694-9577-b99956217780/aspnetdb-migration-error?forum=ssdsgetstarted
Edit (2018-08-23): Since the existing answer is from 2014, I figured I'd serve it a fresh update... Microsoft now offers the DMA (Data Migration Assistant) to migrate SQL Server databases to Azure SQL.
You can learn more and download the free tool here: https://learn.microsoft.com/en-us/azure/sql-database/sql-database-migrate-your-sql-server-database
As of 9/2018, there is a new tool called the Data Migration Assistant that can help with the task of migrating an existing on-premise SQL Server Database to Azure. While the tool will NOT resolve the issue of migrating Windows Logins, it will at least help you get your database schema and data migrated up to Azure.
Here is the overview of the tool: https://learn.microsoft.com/en-us/sql/dma/dma-overview?view=sql-server-2017
You can download the Data Migration Assistant here:
https://www.microsoft.com/en-us/download/details.aspx?id=53595
Once you have migrated your database up to Azure, you can configure an AD Administrator on the SQL Server, then create contained users in your database to allow users to login to your SQL Database with their Windows accounts.

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.

Questions about local database vs service-based database

I have a some questions about local and service-based databases: Does using a service-based database require the user to have SQL Server installed? If so, is there ANY way around it? Does a local database require the user to have SQL Server installed? What is the difference between a local database and a service-based database. (I am talking about the items in Visual Studio)
Clients do not need SQL installed to programatically connect to a database located elsewhere. Whatever mechanism contains the code to connect to databases in general will create the connection. For example, the System.Data namespace of .NET takes care of this for .NET programs. SQL installation is not necessary. Management tools, of course, will not be present on the client.