ASP. net SQL Server registration tool (aspnet_regsql.exe)

Source: Internet
Author: User
Tags website performance sql server express
. NET Framework tool

ASP. net SQL Server registration tool (aspnet_regsql.exe)

 

The ASP. net SQL Server registration tool is used to create a Microsoft SQL Server database for the SQL Server Provider in ASP. NET, or to add or remove options to or from an existing database. The aspnet_regsql.exe file is located in the [drive:] \ windows \ microsoft. Net \ framework \ versionnumber folder on the Web server.

You can run aspnet_regsql.exe without any command line parameters to run a wizard that guides you through the following process: Specify the connection information for SQL Server installation, and install or remove database elements for features such as membership, role manager, configuration file, Web Part personalization settings, and running status monitoring. (This wizard does not involve setting session Status and SQL cache dependencies .) Use the options listed in the following table to run aspnet_regsql.exe as a command line tool to specify the database elements to be added or removed for each function.

Syntax copy code
Aspnet_regsql.exe <options>
SQL connection options
Option Description

-?

The command window displays the aspnet_regsql.exe help text.

-W

Run the tool in wizard mode. If no command line parameter is specified, this is the default setting.

-C<Connection string>

Specifies the connection string of the computer on which the SQL server is running and the database is installed or installed. If you only specify (-S) And login (-UAnd-POr-E), This option is not required.

-S<Server>

Name of the computer on which SQL server is running and the database will be installed or installed.

-U<Login ID>

The ID of the SQL Server user to log on. This option also requires a password (-P. If you want to use Windows creden (-E) For authentication, this option is not required.

-P<Password>

The SQL Server password to be used for logon. This option also requires the use of user ID (-U. If you want to use Windows creden (-E) For authentication, this option is not required.

-E

Use the Windows creden。 of the current logon user for authentication.

-Sqlexportlonly<FILENAME>

Generate an SQL script file that can be used to add or remove a specified function. Do not perform the specified operation.

Application Service options
Option Description

-All | M | r | p | c | W

Add support for one or more ASP. NET application services. You can specify a Service Identifier at the same time or separately. The following identifiers are used for ASP. NET application services.

All-- All services, including common tables and stored procedures shared by services.

M-- Membership

R-- Role Manager

P-- Configuration file

C-- Customize Web parts

W-- Web events

-RAll | M | r | p | c | W

Remove support for one or more application services. You can specify a Service Identifier at the same time or separately. The following identifiers are used for ASP. NET application services.

All-- All services, including common tables and stored procedures shared by services.

M-- Membership

R-- Role Manager

P-- Configuration file

C-- Customize Web parts

W-- Web events

-Q

Run the tool in quiet mode and do not confirm before removing the application service.

-D<Database>

Specifies the name of the database to be created or modified for use with the application service. If no database is specified, the default database name "aspnetdb" is used ".

SQL cache dependency options (for Microsoft SQL Server 7.0, Microsoft SQL Server 2000, and SQL Server 2005)
Option Description

-D<Database>

Specifies the name of the database to be used with the SQL cache dependency. You can also choose to use the connection string Option-CSpecify the database.

-Ed

Enable the database for SQL cache dependencies.

-Dd

Disables the database for SQL cache dependencies.

-Et

Enable tables for SQL cache dependencies. The parameter string must also contain-T.

-Dt

Disables tables for SQL cache dependencies. The parameter string must contain-T.

-T<Table>

Specifies the name of the table to be enabled or disabled for use with the SQL cache dependency. This option must be-EtOr-DtOption.

-Lt

Lists All tables that are enabled for SQL cache dependencies.

Session status options
Option Description

-D<Database>

Name of the database to store the session status. If-SstypeIf it is set to "C", this option must be used.

-Ssadd

Added support for SQL Server Mode session status.

-Ssremove

Remove the support for SQL Server Mode session status.

-SstypeT | p | C

Type of the session status to be used:

T-- Temporary. Session status data is stored in the SQL Server tempdb database. The stored procedure for session state management is installed in the aspstate database of SQL Server. If you restart the SQL statement, the data is not maintained. This is the default setting.

P-- Persistent. Session status data and stored procedures are stored in the aspstate database of SQL Server.

C-- Custom. Session status data and stored procedures are stored in the custom database. Required-DSpecifies the database name.

Remarks

You can use the ASP. net SQL Server registration tool to set several types of options. You can specify an SQL connection and an ASP.. NET application service, indicating which database or table is used for SQL cache dependencies, and adding or removing support for SQL Server Stored Procedures and session states.

Several ASP. NET application services rely on providers to manage data storage and retrieval in data sources. Each provider is specific to a data source. ASP. NET includes an SQL server provider for the following ASP. NET functions:

  • Membership (sqlmembershipprovider class ).

  • Role management (sqlroleprovider class ).

  • Configuration file (sqlprofileprovider class ).

  • Customize Web parts (sqlpersonalizationprovider class ).

  • Web events (sqlwebeventprovider class ).

When ASP. NET is installed, the server's machine. config file contains some configuration elements that specify the SQL server provider for each ASP. NET feature that depends on the provider. By default, these providers are configured to connect to the local user instance of SQL Server express 2005. If you want to change the default connection string used by the provider, you must first use aspnet_regsql.exe to install the SQL Server database and the database elements used for the selected features before using any ASP.. net. If the database specified by the SQL registration tool does not exist (if a database is not specified in the command line, aspnetdb will be the default database ), the current user must have the permissions to create a database in SQL Server and to create Architecture elements in the database.

Each SQL server provider can use the same SQL Server database to store data for this specific function. Each function can be used independently or in combination with other functions. For example, role management can be used independently or in combination with user information managed by membership.

For more information about SQL server providers and ASP. NET, see implementing membership providers, implementing configuration file providers, and implementing role providers.

SQL cache Dependencies

An advanced function of ASP. net output cache is the SQL cache dependency. SQL cache dependencies support two different modes of operation: the first mode is implemented using ASP. NET for table polling, and the second mode is the query notification function of SQL Server 2005. The SQL registration tool can be used to configure the table polling mode. The SQL cache dependency allows you to cache pages that depend on data in SQL Server tables. You can configure SQL Server and ASP. NET to cache page requests to reduce server workload until the page dependent data has been updated in SQL Server. SQL cache dependencies are useful for data that maintains static product directories or customer registration information. Note that when SQL is used to cache the ASP. net table polling mode, you must configure SQL Server. NET provides appropriate notifications about changes in dependent data. Therefore, you must have the management privilege of configuring the server. For more information about SQL cache dependencies, see Walkthrough: use ASP. net output cache in combination with SQL Server and Walkthrough: Use output cache to enhance website performance.

Session Status

ASP. NET session status is designed to allow you to conveniently store user session data of ASP. NET Applications in different sources. By default, session Status values and information are stored in the memory of ASP. NET processes. In addition, session data can be stored in the SQL Server database. In this case, session data can be shared by multiple web servers. For more information about session status, see implementing session Status storage providers and session Status modes.

If the database specified by the SQL registration tool for the session status does not exist, the current user must have the permission to create a database in SQL Server and the permission to create Architecture elements in the database. If the database does not exist, the current user must have the permission to create Architecture elements in the existing database.

To install the session status database on SQL Server, run the aspnet_regsql.exe tool and provide the following information for the command:

  • Use-SSpecifies the name of the SQL server instance.

  • The logon credential of the account that has the right to create a database on the computer running SQL Server. Use-EOption to use the user currently logged on, or use-USpecifies the user ID and uses-PSpecifies the password.

  • Used to add a session status database-SsaddCommand line options.

By default, you cannot use the aspnet_regsql.exe tool to install the session status database on a computer running SQL Server 2005 express edition. For more information about using SQL Server 2005 express edition to store session status, see session Status mode.

Example

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 SQL Server database, install or remove database elements for 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 set the SQL cache dependency or set the session status, you must use the command line tool.

To run the wizard, run aspnet_regsql.exe without any command line parameters, as shown in the following example.

Copy code
C:\WINDOWS\Microsoft.NET\Framework\<versionNumber>\aspnet_regsql.exe

ASP. net SQL registration tools are usually used-Or-ROptions to specify which functions use the SQL Server Provider.-Option allows you to add support for one or more features, while-ROption to remove a feature. The following command uses Windows authentication to install the membership and role Manager database elements on the local computer on which SQL server is running.

Copy code
aspnet_regsql.exe -E -S localhost -A mr

To set SQL cache dependencies, you must have administrative privileges, or manage accounts and passwords. The following command enables the SQL cache dependency for the employees table in the northwind database.

Copy code
aspnet_regsql.exe -S <Server> -U <Username> -P <Password> -ed -d Northwind -et -t Employees

The following command creates a database named aspstate on the SQL server instance named "samplesqlserver" and specifies that session data is also stored in the aspstate database.

Copy code
aspnet_regsql.exe -S SampleSqlServer -E -ssadd -sstype p
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.