ms-help://MS.VSCC.v90/MS.M
Main Topics
Browse All TopicsI am using a new instance of SQLServer 2005 developer without SQLExpress to test a CreateUserWizard form and get the following error:
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
SQLExpress database file auto-creation error:
The connection string specifies a local Sql Server Express instance using a database location within the applications App_Data directory. The provider attempted to automatically create the application services database because the provider determined that the database does not exist. The following configuration requirements are necessary to successfully check for existence of the application services database and automatically create the application services database:
If the applications App_Data directory does not already exist, the web server account must have read and write access to the applications directory. This is necessary because the web server account will automatically create the App_Data directory if it does not already exist.
If the applications App_Data directory already exists, the web server account only requires read and write access to the applications App_Data directory. This is necessary because the web server account will attempt to verify that the Sql Server Express database already exists within the applications App_Data directory. Revoking read access on the App_Data directory from the web server account will prevent the provider from correctly determining if the Sql Server Express database already exists. This will cause an error when the provider attempts to create a duplicate of an already existing database. Write access is required because the web server accounts credentials are used when creating the new database.
Sql Server Express must be installed on the machine.
The process identity for the web server account must have a local user profile. See the readme document for details on how to create a local user profile for both machine and domain accounts.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[SqlException (0x80131904): An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)]
System.Data.SqlClient.SqlI
System.Data.SqlClient.TdsP
System.Data.SqlClient.TdsP
System.Data.SqlClient.SqlI
System.Data.SqlClient.SqlI
System.Data.SqlClient.SqlI
System.Data.SqlClient.SqlI
System.Data.SqlClient.SqlC
System.Data.ProviderBase.D
System.Data.ProviderBase.D
System.Data.ProviderBase.D
System.Data.SqlClient.SqlC
System.Web.Management.SqlS
[HttpException (0x80004005): Unable to connect to SQL Server database.]
System.Web.Management.SqlS
System.Web.Management.SqlS
System.Web.Management.SqlS
System.Web.DataAccess.SqlC
--------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433
Is a default database for Membership profile and roles missing? Please advise how to create it and tie it to my app. Thanks.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: WanaBRichPosted on 2008-07-08 at 07:16:47ID: 21954045
Yes you need to run this: NET\Framew ork\<versi onNumber>\ aspnet_reg sql.exe
talling the Database using Aspnet_regsql.exe ET\Framewo rk\version Number folder on your Web server. Aspnet_regsql.exe is used to both create the SQL Server database and add or remove options from an existing database.
ramework\< versionNum ber>\aspne t_regsql.e xe
C:\WINDOWS\Microsoft.
Ins
ASP.NET includes a tool for installing the SQL Server database used by the SQL Server providers, named Aspnet_regsql.exe. The Aspnet_regsql.exe tool is located in the drive:\WINDOWS\Microsoft.N
You can run Aspnet_regsql.exe without any command line arguments to run a wizard that will walk you through specifying connection information for the computer running SQL Server and installing or removing the database elements for all the supported features. You can also run Aspnet_regsql.exe as a command-line tool to specify database elements for individual features to add or remove.
Note:
The database elements that are installed in the feature database will always be owned by the SQL Server database owner account (dbo). In order to install the feature database, a SQL Server login must be permitted to the db_ddladmin and dd_securityadmin roles for the SQL Server database. However, you do not need to be a system administrator for the SQL Server in order to install the feature database.
To run the Aspnet_regsql.exe wizard, run Aspnet_regsql.exe without any command line arguments, as shown in the following example:
C:\WINDOWS\Microsoft.NET\F
You can also run the Aspnet_regsql.exe tool as a command-line utility. For example, the following command installs the database elements for membership and role management on the local computer running SQL Server:
aspnet_regsql.exe -E -S localhost -A mr
The following table describes the command line options supported by the Aspnet_regsql.exe tool.
OptionDescription
-?Prints Aspnet_regsql.exe tool Help text in the command window.
-WRuns the tool in wizard mode. This is the default if no command line arguments are specified.
-C connection stringThe 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 serverThe 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 idThe 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 passwordThe 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).
-EAuthenticates using the Windows credentials of the currently logged-in user.
-d databaseThe name of the database to create or modify. If the database is not specified, the default database name of "aspnetdb" is used.
-sqlexportonly filenameGenerates 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|wAdds support for one or more features. The following identifiers are used for ASP.NET features.
IdentifierAffects
allAll features
mMembership
rRole management
pProfile
cWeb Parts personalization
wWeb events
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
-R all|m|r|p|c|wRemoves support for one or more features. The following identifiers are used for ASP.NET features.
IdentifierAffects
allAll features
mMembership
rRole management
pProfile
cWeb Parts personalization
wWeb events
Feature identifiers can be specified together or separately, as shown in the following examples.
aspnet_regsql.exe -E -S localhost -R mp
aspnet_regsql.exe -E -S localhost -R m -R p
-QRuns the tool in quiet mode and does not confirm before removing a feature.