Problems with WebParts

G

Guest

I seem to be having a problem using web parts after the beta 2 release. Any
time I try to have the WebPartManager on any page, I get the exception listed
below. I've gone through the steps listed below and have gone as far as
given EVERYONE full control of the App_Data folder. I am using the default
settings (which I assume is the Cassini web server), so I believe it is a
user permissions problem. Furthermore, if I publish the site under IIS, it
works fine. What am I missing and how can I make sure that my user has
dbcreator privileges for SQLExpress?

Thanks in advance.


Exception below

************************************************************************************************************************


Failed to generate a user instance of SQL Server due to a failure in
starting the process for the user instance. The connection will be closed.
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 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.
SQL Server Express must be installed on the machine.
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.
The web server account used to connect to SQL Server Express must have
rights to create a new database.
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.
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.

***********************************************************
***********************************************************
end exception (minus the stack trace)
 
G

Guest

I'm not WebParts expert - just getting it all straight in my head now, but I
have seen this problem a couple of times and know what it is about.

Firstly you must have the aspnetdb personalization installed - this can be
done with the aspnet_regsql.exe tool that lives in the Framework 2.0
directory (%systemroot%\Microsoft.Net\v2.0.50215 on my machine), there are
several good artciles on using this and also runing at prompt with /? will
list what you can do also).

When that is installed you need to make sure that the connection strings
being used are correct. By default these are inherited from the web.config
in the CONFIG folder of the framework (above folder). It expects a
connectionstring names "LocalSqlServer" which uses integrated security to get
to a database called aspnetdb.

If this connection fails it tries to create the data itself I believe.

What I have done to sort this out is to add the providers to my web.config
so that they override the framework settings (web.config in CONFIG folder),
making sure theat they use a valid connection string. Once this is in place
you should be good to go and not see this message again - I think the error
message it is a little misleading.

Here's a copy of a web.config that works for me - you'll need to update the
connection string of course (this is with Visual Studio 2005 Beta2).

Note the providers under Membership, RoleManager and WebParts sections - I
am guessing you do not have one for webparts at the moment and this is the
cause of your problem.


<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings />
<connectionStrings>
<clear />
<add name="aspnetdbConnectionString"
connectionString="server=(local);database=aspnetdb;uid=sa;pwd=sa"
providerName="System.Data.SqlClient" />

</connectionStrings>
<system.web>
<membership>
<providers>
<remove name="AspNetSqlMembershipProvider" />
<add connectionStringName="aspnetdbConnectionString"
name="AspNetSqlMembershipProvider"
type="System.Web.Security.SqlMembershipProvider, System.Web,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</membership>
<roleManager enabled="true">
<providers>
<remove name="AspNetSqlRoleProvider" />
<add connectionStringName="aspnetdbConnectionString" applicationName="/"
name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider,
System.Web, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</roleManager>
<authentication mode="Forms" />
<authorization>
<deny users="?" />
</authorization>
<compilation debug="true" defaultLanguage="c#" />
<webParts enableExport="true">
<personalization>
<providers>
<clear />
<add connectionStringName="aspnetdbConnectionString"
name="AspNetSqlPersonalizationProvider"
type="System.Web.UI.WebControls.WebParts.SqlPersonalizationProvider,
System.Web, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" />
</providers>

<authorization>
<deny users="*" verbs="enterSharedScope" />
<allow users="*" verbs="modifyState" />
</authorization>
</personalization>

<transformers>
<add name="RowToFieldTransformer"
type="System.Web.UI.WebControls.WebParts.RowToFieldTransformer" />
<add name="RowToParametersTransformer"
type="System.Web.UI.WebControls.WebParts.RowToParametersTransformer" />
</transformers>
</webParts>

</system.web>
</configuration>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top