Udostępnij za pośrednictwem


Create and Initialize a Database Using Windows Server AppFabric Cmdlets

You can use AppFabric cmdlets to create and initialize a persistence or monitoring store. However, these cmdlets will not add a connection string entry to AppFabric to allow these stores to be accessed. To accomplish this task, you must use IIS Manager extensions. For more information, refer to Create and Initialize a Database Using IIS Manager.

Create and Initialize a Data Store

You can initialize a persistence store by using the AppFabric cmdlet, Initialize-ASPersistenceSqlDatabase. In the following procedure we will use a subset of the full range of parameters available for Initialize-ASPersistenceSqlDatabase. You must be a member of AS_Administrators to perform this procedure, and you must run the Windows PowerShell console as an administrator.

To initialize a persistence store by using AppFabric cmdlets

  1. Open the Windows PowerShell console.

  2. Execute the following command:

    Initialize-ASPersistenceSqlDatabase –Database NewPersistenceDatabase –Server localhost –Readers AS_Observers –Users “BUILTIN\IIS_IUSRS” –Admins AS_Administrators
    

You can initialize a monitoring database by using the AppFabric cmdlet, Initialize-ASMonitoringSqlDatabase. In the following procedure you use a subset of the full range of parameters available for Initialize-ASMonitoringSqlDatabase. You must have database creation privileges on the database server you are using to perform this procedure. Also, you must run the Windows PowerShell console as an administrator.

To initialize a monitoring store by using AppFabric cmdlets

  1. Open the Windows PowerShell console.

  2. Execute the following command:

    Initialize-ASMonitoringSqlDatabase –Database NewMonitoringDatabase –Server localhost –Readers AS_Observers –Writers “NT SERVICE\AppFabricEventCollectionService” –Admins AS_Administrators
    

    The -Writers parameter must use the identity of the Event Collection service if the database server is on your local computer. If in a domain group, the recommended procedure is to create a domain group and add users to it that the Event Collection service will run as on the domain computers. You then use this domain group as the parameter for the -Writers parameter when initializing the monitoring store. Assuming that you have the necessary permissions, the store name and host are valid, and all the security groups exist, a new monitoring store will be created and initialized for you.

Note

When using Initialize-ASMonitoringSqlDatabase from a C# program, an error similar to this may appear” “Cannot open database 'monitoringdb' requested by the login. The login failed. Login failed for user 'domainx\usery”. The workaround to this is to add "pooling=false" to the connectionString parameter of the Initialize-ASMonitoringSqlDatabase cmdlet.

Note

If you are using a named SQL Server instance (such as SQLEXPRESS) you will have to specify the instance explicitly by using the -Server parameter as in the following example:

Initialize-ASMonitoringSqlDatabase -Database NewDB -Server localhost\SQLEXPRESS