Several ASP. NET functions rely on providers to manage data storage and retrieval in data sources. Each provider is specific to a data source. ASP. NET includes a Microsoft SQL server provider for the following ASP. NET functions:
Membership ( Class ).
Role management ( Class ).
Configuration file ( Class ).
Web parts personalized settings ( Class ).
Web events ( Class)
By default, each SQL server provider uses Microsoft SQL Server express installed locally to store data in automatically generated databases. Each function can be used independently or in combination with other functions. For example, you can use role management separately or combine it with the user information managed by the membership function.
Pre-configured SQL Server Provider
Install ASP. net, the computer configuration file and the root web of the server. the config file contains some configuration elements that depend on each ASP of the provider.. net function specifies the SQL Server Provider. By default, these providers are configured to connect to the local instance of SQL Server Express. If you plan to only use SQL Server express in the Computer Configuration File You do not need to perform any manual settings on the database. If you need to configure the database using the SQL Server Standard version running on the same server, or you need to configure a remote SQL server computer, you need to use this tool.
Note: |
The aspnet_regsql tool should not be installed locally in the user instance mode (that is, the connection string containsUser Instance=true ) Run SQL Server express together. |
Use aspnet_regsql.exe to install the database
ASP. NET includes a tool named aspnet_regsql.exe, which is used to install the SQL Server database used by the SQL Server Provider. The aspnet_regsql.ex tool is located on the Web ServerDrive:\ Windows \ Microsoft. NET \ framework \VersionnumberFolder. Aspnet_regsql.exe can be used to create an SQL Server database and add or remove options to or from an existing database.
You can run aspnet_regsql.exe without using any command line parameters to run a wizard that guides you through the following process: Specify the connection information for the computer running SQL Server, install or remove database elements for all supported features. You can also run aspnet_regsql.exe as a command line tool to specify the database elements to be added or removed for each function.
To run the aspnet_regsql.exe wizard, run aspnet_regsql.exe without any command line parameters, 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 database elements for member qualifications and role management on the local computer on which SQL Server is run:
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 |
-? |
The command window displays the aspnet_regsql.exe tool help text. |
-W |
Run the tool in wizard mode. If no command line parameter is specified, this is the default setting. |
-CConnection string |
The connection string of the computer on which the SQL server is running and the database is installed or installed. This option is not required if you only specify the server (-S) and login (-U and-P or-e) information. |
-SServer |
Name of the computer that is running SQL Server and will be installed or has installed the database. The server name can also include the Instance name, as shown in figure.\INSTANCENAME . |
-ULogin ID |
The ID of the SQL Server user to log on. This option also requires the password (-p) option. This option is not required if you want to use Windows creden (-E) for authentication. |
-PPassword |
The SQL Server password to be used for logon. This option also requires the logon ID (-u) option. This option is not required if you use Windows creden( (-E) for authentication. |
-E |
Use the Windows creden。 of the current logon user for authentication. |
-DDatabase |
Name of the database to be created or modified. If no database is specified, the default database name "aspnetdb" is used ". |
-SqlexportonlyFilename |
Generate an SQL script file that can be used to add or remove a specified function. Do not perform the specified operation. |
-A all | M | r | p | c | W |
Add support for one or more features. The following identifiers are used for ASP. NET functionality.
Identifier |
Impact |
All |
All functions |
M |
Member qualifications |
R |
Role management |
P |
Configuration File |
C |
Customize Web parts |
W |
Web events |
Feature identifiers can be specified together or separately, as shown in the following example. 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 |
Remove support for one or more features. The following identifiers are used for ASP. NET functionality.
Identifier |
Impact |
All |
All functions |
M |
Member qualifications |
R |
Role management |
P |
Configuration File |
C |
Customize Web parts |
W |
Web events |
Feature identifiers can be specified together or separately, as shown in the following example. aspnet_regsql.exe -E -S localhost -R mp
aspnet_regsql.exe -E -S localhost -R m -R p
|
-Q |
Run the tool in quiet mode without confirmation before removing the feature. |