Hello igotyourdotnet,
From your description, you're getting "An error has occurred while
establishing a connection to the server. ............" when try running an
ASP.NET 2.0 page whch use the webpart on it, correct?
Based on my experience, such problem is likely due to the webpart
service(personalization service)'s provider can not correctly establish
connection to the underlying database(which persist webpart data). Are you
using using customized provider setting for your personaliation
service(webpart) or use the default SqlServer provider(point to a
sqlexpress database file)? By default, all the ASP.NET 2.0 applciation
services(include membership, rolemanager, profile, personalization ...)
are using Sql provider and the connection string is pointing to a local
sqlexpress database file(in App_Data folder). You can open the
machine.config file on the server and locate the default "LocalSqlServer"
connectionstring as below:
===================
<connectionStrings>
<add name="LocalSqlServer" connectionString="data
source=.\SQLEXPRESS;Integrated
Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User
Instance=true" providerName="System.Data.SqlClient" />
==================
and the default webpart/personalization service's provider setting is in
the machine level web.config file(the same dir with machine.config) as
below:
========================
..................
<webParts>
<personalization>
<providers>
<add connectionStringName="LocalSqlServer"
name="AspNetSqlPersonalizationProvider"
type="System.Web.UI.WebControls.WebParts.SqlPersonalizationProvider,
System.Web, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
..........................
</webParts>
</system.web>
=============================
as you can see, it use the "LocalSqlServer" connectionstring by default.
Therefore, if you haven't manually change to use customized provider or
database connection, the problem here is possiblye due to the current
ASP.NET runtime fail to create connection to the default SQL Express
database file. For general troubleshooting, you can try the following
steps:
1.Create a new project and test the same things to see whether it works.
Also, you can try using other services such as membership, profiles with
the default Sql provider to see whether they can work. This can further
isolate whether the problem is specfic to all providers using the default
sql database file or just the webpart/ personalization service.
2. Are you creating and developing the web project through HTTP/IIS server
or file system/test server? When developing in IIS, the runtime use the
IIS worker process identity as security context and for IIS5, its the
machine\ASPNET, for IIS6, it's the Network Service by default. If this is
the case, you can try swtich the worker process identity to a powerful
account(such as the local system) to see whether it works. This can help
check whether the problem is due to security permission.
#Configuring ASP.NET Process Identity
http://msdn2.microsoft.com/en-us/library/dwc1xthy.aspx
3. for testing, if you have a SQL Server 2000 or SQL server 2005 database
server instance available, you can manually configure your ASP.NET
application's service to use the SQL Server 2000/2005 instance as
persistent storage. To do this you can follow the guide in the following
articles.(include change the connectionstring I mentioned above):
#Creating and Configuring the Application Services Database for SQL Server
http://msdn2.microsoft.com/en-us/library/2fx93s7w.aspx
#Configuring ASP.NET 2.0 Application Services to use SQL Server 2000 or SQL
Server 2005
http://www.topxml.com/XML/re-13439_Configuring-ASP-NET-2-0-Application-Servi
ces-to-use-SQL-Server-2000-or-SQL-Server-2005.aspx
Hope this helps. If there is any other findings or anything unclear, please
feel free to let me know.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.