Add a Provider (IIS 7)

Applies To: Windows 7, Windows Server 2008, Windows Server 2008 R2, Windows Vista

Add a provider in IIS when you have an application that uses a provider-based service to store data in a database or other data store. For example, the session state service in ASP.NET is a provider-based service that manages per-user session state by storing it in process (in memory in the application domain of the host application), in memory in an external process (the "state server process"), or in a Microsoft SQL Server database.

noteNote
Adding a configuration setting adds the setting at the local level and to any child levels that inherit the setting.

For information about the levels at which you can perform this procedure, and the modules, handlers, and permissions that are required to perform this procedure, see Providers Feature Requirements (IIS 7).

Exceptions to feature requirements

  • None

You can perform this procedure by using the user interface (UI), by running Appcmd.exe commands in a command-line window, by editing configuration files directly, or by writing WMI scripts.

  1. Open IIS Manager and navigate to the level you want to manage. For information about opening IIS Manager, see Open IIS Manager (IIS 7). For information about navigating to locations in the UI, see Navigation in IIS Manager (IIS 7).

  2. In Features View, double-click Providers.

  3. On the Providers page, under Feature, select one of the following features:

    • .NET Roles: to configure the provider to provide an interface between the ASP.NET role management service (the "role manager") and role data sources.

    • .NET Users: to configure the provider to provide an interface between the ASP.NET membership service and membership data sources.

    • .NET Profile: to configure the provider to provide an interface between the ASP.NET profile service and profile data sources.

  4. In the Actions pane, click Add.

  5. In the Add Provider dialog box, select a provider type from the Type drop-down list.

  6. In the Name text box, type a name for the provider.

  7. If the .NET Users feature was selected in step #3, in the Profile properties section, under Behavior, set the value of one or more of the following behaviors to True to enable the behavior:

    • EnablePasswordReset: indicates whether passwords can be reset by using the provider's ResetPassword method. The default setting is False.

    • EnablePasswordRetrieval: indicates whether passwords can be retrieved by using the provider's GetPassword method. The default setting is False.

      ImportantImportant
      Some providers, such as the Active Directory provider, do not support the retrieval of passwords. For these providers, the value of the enablePasswordRetrieval attribute is always False and cannot be changed in configuration.

    • RequiresQuestionAndAnswer: indicates whether a password answer must be supplied when the program calls the provider's GetPassword and ResetPassword methods. The default setting is False.

    • RequiresUniqueEmail: indicates whether each registered user must have a unique e-mail address. The default setting is False.

    • StorePasswordInSecureFormat: indicates whether passwords should be hashed. The default setting is False.

  8. Under Data, type the name of the connection string that is used to connect to the database in the ConnectionStringName text box.

    noteNote
    This is the same connection string that was configured under the Connection Strings feature. For more information about how to configure connection strings, see Configuring Connection Strings in IIS 7. If the WindowsTokenRoleProvider was selected in step #5 of this procedure, a connection string name is optional.

  9. Optionally, in the Profile properties section, under General, type the virtual path of the application in the ApplicationName text box. If you do not specify a value in the ApplicationName text box, the membership API defaults to HttpContext.Current.Request.ApplicationPath. This can be determined only at runtime.

  10. Optionally, in the Profile properties section, under General, type a description of the provider in the Description text box.

  11. Click OK.

To add a .NET role provider, use the following syntax:

Appcmd set config /commit:MACHINE /section:roleManager /+"providers.[name=' string ',type=' string ',connectionStringName=' string ',applicationName=' string ']"

The variable name string is the name of the provider. The variable type string is the provider type. The variable connectionStringName string is the name of the connection string that is used to connect to the database. The variable applicationName string is optional and is the virtual path of the application. For example, to configure an ASP.NET application to use the SqlRoleProvider class to store and retrieve role information, type the following at the command prompt, and then press Enter:

Appcmd set config /commit:MACHINE /section:roleManager /+"providers.[name='SqlProvider',type='System.Web.Security.SqlRoleProvider',connectionStringName='SqlServices',applicationName='SampleApplication']"

To add a .NET user provider, use the following syntax:

Appcmd set config /commit:MACHINE /section:membership /+"providers.[name=' string ',type=' string ',connectionStringName=' string ',applicationName=' string ',enablePasswordReset='True|False',enablePasswordRetrieval='True|False',requiresQuestionAndAnswer='True|False',requiresUniqueEmail='True|False',storePasswordInSecureFormat='True|False']"

The variable name string is the name of the provider. The variable type string is the provider type. The variable connectionStringName string is the name of the connection string that is used to connect to the database. The variable applicationName string is optional and is the virtual path of the application. The variable enablePasswordReset True enables password reset using the provider's ResetPassword method. The default setting is False. The variable enablePasswordRetrieval True enables password retrieval by using the provider's GetPassword method. The default setting is False. The variable requiresQuestionAndAnswer True requires that a password answer must be supplied when the program calls the provider's GetPassword and ResetPassword methods. The default setting is False. The variable requiresUniqueEmail True requires that each registered user has a unique e-mail address. The default setting is False. The variable storePasswordInSecureFormat True requires that all passwords must be hashed. The default setting is False. For example, to configure an ASP.NET application to use the SqlMembershipProvider class to store and retrieve user information, type the following at the command prompt, and then press Enter:

Appcmd set config /commit:MACHINE /section:membership /+"providers.[name='SqlProvider',type='System.Web.Security.SqlMembershipProvider',connectionStringName='SqlServices',applicationName='/',enablePasswordRetrieval='False',enablePasswordReset='True',requiresQuestionAndAnswer='True']"

To add a .NET profile provider, use the following syntax:

Appcmd set config /commit:MACHINE /section:profile /+"providers.[name=' string ',type=' string ',connectionStringName=' string ',applicationName=' string ']"

The variable name string is the name of the provider. The variable type string is the provider type. The variable connectionStringName string is the name of the connection string that is used to connect to the database. The variable applicationName string is optional and is the virtual path of the application. For example, to configure an ASP.NET application to use the SqlProfileProvider class to store and retrieve profile information, type the following at the command prompt, and then press Enter:

Appcmd set config /commit:MACHINE /section:profile /+"providers.[name='SqlProvider',type='System.Web.Profile.SqlProfileProvider',connectionStringName='SqlServices',applicationName='SampleApplication']"

For more information about Appcmd.exe, see Appcmd.exe (IIS 7).

The procedure in this topic affects the following configuration elements:

  • <providers>

For more information about IIS 7 configuration, see IIS 7.0: IIS Settings Schema on MSDN.

Use the following WMI classes, methods, or properties to perform this procedure:

  • RoleManagerSection.Add method

  • MembershipSection.Add method

For more information about WMI and IIS, see Windows Management Instrumentation (WMI) in IIS 7. For more information about the classes, methods, or properties associated with this procedure, see the IIS WMI Provider Reference on the MSDN site.

See Also

Community Additions

ADD
Show: