8. June 2010 13:11
Aspnet_regsql.exe is a tool for installing the SQL Server database used by the SQL Server providers. The file is located in the "c:\WINDOWS\Microsoft.NET\Framework\versionNumber folder" on your web server. There are too ways to run this tool: the wizard form and the command line.
1. To run this using wizard is very simple.
Step 1: Run the aspnet_regsql.exe from your command line without any arguments. Then the wizard windows form will appear. Click the Next Button.
Step 2: Choose what you want to do with the sql database. In this example we want to create a new application services database. So we just select the first option then Click the Next Button.
Step 3: Enter your sql server name, authentication method and the database name. If the database has already existed, you can select the dropdownlist. If the database is new, you only need to type in the new database name in the dropdownlist. Click the Next Button.
Step 4: Confirm the information then then Click the Next Button.
Step 5: Done.
After that your database should be created. And it should look likes this.
2. Also you can run the tool as a command-line utility. The options for the command are
| 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. |
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
| all || All features |
| m || Membership |
| r || Role management |
| p || Profile |
| c || Web Parts personalization |
| w || Web events |
| -R all|m|r|p|c|w || Removes support for one or more features. The identifiers are the same for the add option.. Here is some 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. |
So if you want to add database elements for membership and role management in database test on localhost using the current windows user. The command should be:
aspnet_regsql.exe -E -S localhost -d test -A mr