
Installing the Database using Aspnet_regsql.exe
ASP.NET includes a tool for installing the SQL Server database used by the SQL Server providers, named Aspnet_regsql.exe. The Aspnet_regsql.exe tool is located in the drive:\WINDOWS\Microsoft.NET\Framework\versionNumber folder on your Web server. Aspnet_regsql.exe is used to both create the SQL Server database and add or remove options from an existing database.
You can run Aspnet_regsql.exe without any command line arguments to run a wizard that will walk you through specifying connection information for the computer running SQL Server and installing or removing the database elements for all the supported features. You can also run Aspnet_regsql.exe as a command-line tool to specify database elements for individual features to add or remove.
Note: |
|---|
The database elements that are installed in the feature database will always be owned by the SQL Server database owner account (dbo). In order to install the feature database, a SQL Server login must be permitted to the
db_ddladmin and dd_securityadmin roles for the SQL Server database. However, you do not need to be a system administrator for the SQL Server in order to install the feature database.
|
To run the Aspnet_regsql.exe wizard, run Aspnet_regsql.exe without any command line arguments, as shown in the following example:
C:\WINDOWS\Microsoft.NET\Framework\<versionNumber>\aspnet_regsql.exe
You can also run the Aspnet_regsql.exe tool as a command-line utility. For example, the following command installs the database elements for membership and role management on the local computer running SQL Server:
aspnet_regsql.exe -E -S localhost -A mr
The following table describes the command line options supported by the Aspnet_regsql.exe tool.
Option
|
Description
|
|---|
-? |
Prints Aspnet_regsql.exe tool Help text in the command window.
|
-W |
Runs the tool in wizard mode. This is the default if no command line arguments are specified.
|
-C connection string |
The connection string to the computer running SQL Server where the database will be installed, or is already installed. This option is not necessary if you only specify the server (-S) and login (-U and -P, or -E) information.
|
-S server |
The name of the computer running SQL Server where the database will be installed, or is already installed. The server name can also include an instance name, such as .\INSTANCENAME.
|
-U login id |
The SQL Server user id to log in with. This option also requires the password (-P) option. This option is not necessary if you are authenticating using Windows credentials (-E).
|
-P password |
The SQL Server password to log in with. This option also requires the login id (-U) option. This option is not necessary if authenticating using Windows credentials (-E).
|
-E |
Authenticates using the Windows credentials of the currently logged-in user.
|
-d database |
The name of the database to create or modify. If the database is not specified, the default database name of "aspnetdb" is used.
|
-sqlexportonly filename |
Generates a SQL script file that can be used to add or remove the specified features. The specified actions are not performed.
|
-A all|m|r|p|c|w |
Adds support for one or more features. The following identifiers are used for ASP.NET features.
Identifier
|
Affects
|
|---|
all |
All features
| m |
Membership
| r |
Role management
| p |
Profile
| c |
Web Parts personalization
| w |
Web events
|
Feature identifiers can be specified together or separately, as shown in the following examples.
aspnet_regsql.exe -E -S localhost -A mp aspnet_regsql.exe -E -S localhost -A m -A p |
-R all|m|r|p|c|w |
Removes support for one or more features. The following identifiers are used for ASP.NET features.
Identifier
|
Affects
|
|---|
all |
All features
| m |
Membership
| r |
Role management
| p |
Profile
| c |
Web Parts personalization
| w |
Web events
|
Feature identifiers can be specified together or separately, as shown in the following examples.
aspnet_regsql.exe -E -S localhost -R mp aspnet_regsql.exe -E -S localhost -R m -R p |
-Q |
Runs the tool in quiet mode and does not confirm before removing a feature.
|