try to setup membership with ASP.NET configuration

When I whant the use the new ASP.NET configuration tool (2005) and I want to define a provider I get the following error.

You should know that on installation of VS 2005 SQL-Server Express did not install and I installed SQL-Server 2005 (shiped with VS 2005). So now it seems that VS waits for the Express edition.

I changed under Tools/Options/Database Tools/Data Connections

the SQL Server Instance Name to "MSSQLSERVER"

but this does not help, too.

Thank you very much for any help!

Regards,

Fabian

--

Server Error in '/asp.netwebadminfiles' Application.

Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

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:

  1. 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.
  2. If the applications App_Data directory already exists, the web server account only requires read 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. Note that 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 SQL Server Express attempts to create a duplicate of an already existing database.
  3. SQL Server Express must be installed on the machine.
  4. If the application services database does not already exist, the SQL Server Express service account must have read and write access to the applications App_Data directory. This is necessary because the SQL Server Express service account will create the application services database.
  5. The web server account used to connect to SQL Server Express must have rights to create a new database.
    1. When using the local web server(Cassini) installed with Visual Studio, the logged-in user needs the dbcreator privilege in the appropriate SQL Server Express instance.
    2. When using IIS, the process account needs the dbcreator privilege in the appropriate SQL Server Express instance. Only consider granting a process account dbcreator privilege on secure development machines.Do not grant the dbcreator privilege on production machines without fully investigating and understanding the security ramifications of running a production web server with the dbcreator privilege. The process account requiring dbcreator privilege varies depending on operating system platform and ASP.NET configuration settings:
      • For IIS5, and IIS6 running in IIS5 isolation mode, the default web server account is the local ASPNET machine account.
      • For IIS6 native mode, the default web server account is NETWORK SERVICE.
      • If application impersonation is enabled, then the application impersonation account requires the dbcreator privilege.
      • If an explicit account was specified for the web server process (either in the <processModel> element for IIS5 and IIS5 isolation mode, or the application pool account on IIS6), then the explicit account requires the dbcreator privilege.

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): Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.] System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +684979 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +207 System.Data.SqlClient.TdsParser.Connect(Boolean& useFailoverPartner, Boolean& failoverDemandDone, String host, String failoverPartner, String protocol, SqlInternalConnectionTds connHandler, Int64 timerExpire, Boolean encrypt, Boolean integratedSecurity, SqlConnection owningObject, Boolean aliasLookup) +890 System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +601 System.Data.SqlClient.SqlInternalConnectionTds..ctor(SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +159 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +108 System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup) +27 System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +47 System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105 System.Data.SqlClient.SqlConnection.Open() +111 System.Web.Management.SqlServices.GetSqlConnection(String server, String user, String password, Boolean trusted, String connectionString) +67 [HttpException (0x80004005): Unable to connect to SQL Server database.] System.Web.Management.SqlServices.GetSqlConnection(String server, String user, String password, Boolean trusted, String connectionString) +123 System.Web.Management.SqlServices.SetupApplicationServices(String server, String user, String password, Boolean trusted, String connectionString, String database, String dbFileName, SqlFeatures features, Boolean install) +90 System.Web.DataAccess.SqlConnectionHelper.EnsureValidMdfFile(String fullFileName, String dataDir, String connectionString) +345


Version Information: Microsoft .NET Framework Version:2.0.50215.44; ASP.NET Version:2.0.50215.44

[7376 byte] By [fabianus] at [2008-2-22]
# 1
Make sure the SQL Server Express service is started, you can check this in the Control Panel/Services

The instance is "SQLEXPRESS" for a default Visual Studio installation.

RobWalters at 2007-9-9 > top of Msdn Tech,SQL Server,.NET Framework inside SQL Server...
# 2
Yep...by default, SQL Express is the default data storage used by ASP.NET 2.0. You can also use a full blown SQL Server database. How?

1) Create a database in SQL Server (2000 or 2005) and make sure that you give the ASPNET account permissions to this database.
2) Run the aspnet_regsql.exe file in your %SystemRoot%\Microsoft.NET\Framework\v2.0.xyz directory. This will open an ASP.NET SQL Server Setup Wizard which will create the objects necessary for ASP.NET security.
3) Point to the database you just created.
4) In your web.config file, locate the <connectionStrings> element and add the following:

<remove name="LocalSqlServer" />
<add name="LocalSqlServer" connectionString="Data Source=localhost;initial catalog=<your database name>;integrated security=true" providerName="System.Data.SqlClient">

This overrides the default SQL Express and points to the new database you just created - be it in the same machine or a different machine. You can also change the configuration in the machine.config file although this will affect every web application sitting on top of your machine.

Hope this helps.

bass_player at 2007-9-9 > top of Msdn Tech,SQL Server,.NET Framework inside SQL Server...
# 3
Hi, I'm having a terrible time trying to get the new ASP.NET web set administration tool to work and I am wondering if you could help. I created the personal web site in VS 2005 RC1 on my development PC. On a second PC I created my database on SQL 2000 using the peronsal add sql file. I then ran the aspnet_regsql.exe util, using the "sa" account and password against the new database. I used "sa" just so I could eliminate permissions issue for testing puposes. All the SQL procedures were now in one DB nice and tidy.

I modified my web.config in my peronsal site by changing the connection strings to point to the remote SQL 2000 database. I also went ahead and modified the machine.config connection string to point to the same database so the admin tools would work when I came to that point.

I ran the peronsal site in VS 2005 in debug mode to initialize the site. It came up fine. I then stopped the debugger and selected the project name in the solution explorer and clicked the "ASP.NET" configuration button. The default page loaded ok, but when I clicked the security tab this maessage appeared:

"There is a problem with your selected data store. This can be caused by an invalid server name or credentials, or by insufficient permission. It can also be caused by the role manager feature not being enabled. Click the button below to be redirected to a page where you can choose a new data store.

The following message may help in diagnosing the problem: Value cannot be null. Parameter name: virtualPath

After debugging security.aspx. It appears the error lies somewhere in here"

MembershipUserCollection users = (MembershipUserCollection) CallWebAdminHelperMethod(true, "GetAllUsers",new object[] {0, Int32.MaxValue, total}, new Type[] {typeof(int),typeof(int),Type.GetType("System.Int32&")});

Can you point out anything I did wrong or should look to correct? Thank you!

-Robert

RobertTarantino at 2007-9-9 > top of Msdn Tech,SQL Server,.NET Framework inside SQL Server...
# 4
Can you display the changes you made on your machine.config file (only the affected section, of course)?
bass_player at 2007-9-9 > top of Msdn Tech,SQL Server,.NET Framework inside SQL Server...
# 5

You bet. The one section I modifed in the machine config was the connection string which I assumed the ASP web admin app used by default for it's conenction to my personal web database on my remote SQL server.

<connectionStrings>

<add name="LocalSqlServer" connectionString="Data Source=<server name>;initial catalog=TMAP;uid=<user name>;pwd=<password>;" providerName="System.Data.SqlClient"/>

</connectionStrings>

I have been throwing in some response.write statements in the WebAdminPage.cs to debug the ASP.NETWebAdminFiles down in the v2.0.50727 framework directory where the admin app lives. What I am seeing is the the applicationpath variable is coming up as empty string(""). It appears that is not set when calling this line is called:

if (application.Context.Session != null) {
if (application.Context.Session[APP_PATH] != null) {
applicationPath = (
string)application.Context.Session[APP_PATH];
}

The APP_PATH variable is still set to :
private const string APP_PATH = "WebAdminApplicationPath";

I should note that I do not have IIS installed on my development machine. I am assuming I do not need it since I have the AP.NET VS development server and I do not deploy apps to my development machine.

I am almost to the point of reintalling VS 2005 or the .NET 2.0 framework but I would rather understand and solve the underlying issue. If you can think of ra eason why this session.context does not have the values the app is calling for I would be greatly appreciative. Thanks in advance!

-Robert Tarantino

RobertTarantino at 2007-9-9 > top of Msdn Tech,SQL Server,.NET Framework inside SQL Server...
# 6
You also have this element in your web.config. What I did was to add another element in the <connectionStrings> node.

<connectionStrings>

<remove name="LocalSqlServer" />

<
add name="LocalSqlServer" connectionString="Data Source=<server name>;initial catalog=TMAP;uid=<user name>;pwd=<password>;" providerName="System.Data.SqlClient"/>

</connectionStrings>

This overrides the machine.config file on a certain application while the others still use the default configuration settings. I would like to help you out on this. What is your email address?

bass_player at 2007-9-9 > top of Msdn Tech,SQL Server,.NET Framework inside SQL Server...
# 7
My email is terrapin1@tds.net

As an FYI, I have tried uninstalling VS 2005 RC1 and re-installing. I am still receiving the same error. Additional debugging of the ASP.NETWebAdmin web site shows me that the application path is not being retrieved from the HTTPApplication object in the WebAdminPages.cs. I've also tried installing IIS 6.0 to see if this would solve the problem and it of course did not. I am thowing blind darts at this point. Thanks again for taking the time to help.

-Robert

RobertTarantino at 2007-9-9 > top of Msdn Tech,SQL Server,.NET Framework inside SQL Server...
# 8
I suggest that you install the VS 2005 Beta 2 version or the latest CTP to try this out. Also, if you can, use VPC so that you don't mess with your current machine. VPC provides you with a good way to test whether your installation works or not so you can document what had happened during the installation. I am currently running Windows Server 2003 Enterprise Edition with VS 2005 Beta 2 and SQL Server 2005 June CTP (I still don't have time to install the September CTP). I can walk you through the installation procedures on using updated CTPs as they are not compatible with each other (like if you install VS 2005 Beta 2 and SQL Server 2005 June CTP...this should be dealt with caution as the versions of the .NET framework for both are different)
bass_player at 2007-9-9 > top of Msdn Tech,SQL Server,.NET Framework inside SQL Server...
# 9

I just started up a new virtual machine running Win XP SP2. I installed Visual Studio 2005 RC1, and proceeded to try to install the Membership Database on the local instance of SQL Server Express 2005 that was installed in the VS 2005 installation.

I tried running "aspnet_regsql.exe -E -S localhost -A m" in the VS command prompt per the instructions in this article: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag2/html/paght000022.asp.

I keep on getting the following error:

"An error has occurred. Details of the exception:
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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

Unable to connect to SQL Server database."

Even though I specified the localhost for the servername, I enabled local and remote connections in SQL Server 2005 Express. I also enabled TCP and Named Pipes Provider). I have tried about everything. If I run "aspnet_regsql.exe " in the command prompt and go through the wizard, I get a similar error.

Kentmw at 2007-9-9 > top of Msdn Tech,SQL Server,.NET Framework inside SQL Server...
# 10
I have some RAM limitations in using VPC at my home PC's. My experience with VPC is that you need to dedicate a least a 1 gb of ram to it to make it work efficiently. What I can do is install it on my PC where my SQL server 2000 db lies, which is running 2003 server (Result Server 2003 with VS 2005 Beta 2). This of course is not the same configuration as my development workstation (problem child) XP sp2 and VS 2005 RC1, so I am not sure if the test will be valid? I can tell you that I have tried the configuration of server 2003 and VS 2005 RC1 at work and it seems to be fine.

Last night I decided to hard code a couple of variables in the WebAdminPage.cs under the APP_CODE folder in the ASP.NETWebAdminFiles folder (C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\ASP.NETWebAdminFiles\App_Code).

Around line 502 in WebAdminPage.cs

if (application.Context.Request != null) {
queryStringAppPath = (
string) application.Context.Request.QueryString ["applicationUrl"];
queryStringApplicationPhysicalPath = (
string) application.Context.Request.QueryString["applicationPhysicalPath"];

queryStringAppPath = "/TMAP";
queryStringApplicationPhysicalPath =
"C:\\Projects\\C#\\TMAP";

}

The result was as I had hoped, in that the application worked properly. This at least confirmed my analysis that HTTPApplication object in the web admin website was not retaining or obtaining the context needed when firing off the ASP.NET configuration from the solution explorer in VS 2005. The skinny is that I am at least able to work with adminstration of my personal web site until I find the root cause of the problem.

My assumption is that query string parameters are set in a config somewhere that I am overlooking. I have looked at machine.config, web.config in "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG". I have also looked at the wbe config in "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\ASP.NETWebAdminFiles", as well as the web.config in my personal web site root directory. Do you possibly know how these two values are loaded?

RobertTarantino at 2007-9-9 > top of Msdn Tech,SQL Server,.NET Framework inside SQL Server...
# 11
Welll, I randomly found this which fixed my problem. When runing SQL Server Express 2005, localhost does not work for the SQL Server name... you have to use computerName\SQLEXPRESS. So, I was able to install the Membership database with this command "aspnet_regsql.exe -E -S pc001\SQLEXPRESS -A m" (replace pc001 with your computer name). At least I fixed my own problem :)
Kentmw at 2007-9-9 > top of Msdn Tech,SQL Server,.NET Framework inside SQL Server...
# 12

I have the same problem but in a windows 2003. How can I fix this

# 13
Did you ever find the solution to this problem?
HBOne at 2007-9-9 > top of Msdn Tech,SQL Server,.NET Framework inside SQL Server...
# 14
If you are using Virtual PC with SQL Server Express:

http://support.microsoft.com/default.aspx?scid=kb;en-us;896613

The fix will be in the next SP of Windows XP.

RobWalters at 2007-9-9 > top of Msdn Tech,SQL Server,.NET Framework inside SQL Server...

SQL Server

Site Classified