473,385 Members | 1,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

web parts and a database

I'm trying to add a web part to my page and when I run my page with the web
part I get this 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)
Now the entire web site is static and the web part has a calendar, so what
database is it trying to connect to and how can I get rid of this and so I
can run my page with the web parts?

Sep 26 '06 #1
5 2790
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|aspn etdb.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.SqlPerson alizationProvider,
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_C...lication-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/subscripti...ult.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/subscripti...t/default.aspx.

==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.


Sep 27 '06 #2
so to use web parts I need the page connect to a DB? I can't just have static
web parts and no personlization for them?

"Steven Cheng[MSFT]" wrote:
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|aspn etdb.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.SqlPerson alizationProvider,
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_C...lication-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/subscripti...ult.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/subscripti...t/default.aspx.

==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.


Sep 27 '06 #3
Hello igotyourdotnet,

Thanks for your reply.

Yes, if you're using the webpart through the default SQL
provider(AspNetSqlPersonalizationProvider class), you do have to provide a
sqlserver instance or SQLEXPRESS engine.

However, as I said, the ASP.NET 2.0's application servies are all designed
as provider based, it's flexible to create custom provider and use custom
provider to replace the default ones. I've found some web articles that
mentioned creating custom provider (file based for example) to avoid using
database:

#Webparts without SqlExpress or SqlServer
Categories
http://www.kowitz.net/2006/5/2/Webpa...SqlServer.aspx

You can get more information about the provider model in ASP.NET 2.0 and
developing custom provider in the MSDN dev center:

#Provider Toolkit
http://msdn.microsoft.com/asp.net/do...s/default.aspx

Hope this helps.
Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

This posting is provided "AS IS" with no warranties, and confers no rights.
Sep 27 '06 #4
thanks, I'll take a look. this is my first time working with the .NET web
parts on a web app and not in a sharepoint environment.

thanks

"Steven Cheng[MSFT]" wrote:
Hello igotyourdotnet,

Thanks for your reply.

Yes, if you're using the webpart through the default SQL
provider(AspNetSqlPersonalizationProvider class), you do have to provide a
sqlserver instance or SQLEXPRESS engine.

However, as I said, the ASP.NET 2.0's application servies are all designed
as provider based, it's flexible to create custom provider and use custom
provider to replace the default ones. I've found some web articles that
mentioned creating custom provider (file based for example) to avoid using
database:

#Webparts without SqlExpress or SqlServer
Categories
http://www.kowitz.net/2006/5/2/Webpa...SqlServer.aspx

You can get more information about the provider model in ASP.NET 2.0 and
developing custom provider in the MSDN dev center:

#Provider Toolkit
http://msdn.microsoft.com/asp.net/do...s/default.aspx

Hope this helps.
Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

This posting is provided "AS IS" with no warranties, and confers no rights.
Sep 27 '06 #5
Sure. If you have any further questions, please feel free to let me know.
Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Sep 28 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: brett valjalo | last post by:
Hey Gang! SORRY ABOUT THE LENGTH! Nice to see some of the same faces around this place from way back when ... Whatta buncha CDMA addicts some o' y'all are ;) Don't get me wrong, I...
1
by: Matt Swift | last post by:
I have a question regarding the way that we can load page components seperately, so that a user sees various parts of a site load as the data comes back, but the whole site in general is already...
1
by: BenB | last post by:
Hi I have nested masterpages. On each master page there are some user web controls (ascx). I want to have common variables (strings, ints etc) that I can access throughout all parts of the...
3
by: weboweb | last post by:
Hi, I'm new in web parts, I would like to understand a couple of things: Let's say I have a custom control that displays information. That info is fed to the control through an XML string, so...
0
by: tommydog | last post by:
i want to add a parts viewer system to a website. the user selects the item they own from a database and then the page shows a parts diagram, related diagrams and a parts list (to be integrated into...
18
by: =?Utf-8?B?Q2hhcmxlc0E=?= | last post by:
I've just finished getting my web 2.0 MCTS, and the exam seemed to have a disproportionate interest in Web Parts. Personally, I don't really see the point of them Should I think again? can...
3
by: sara | last post by:
Very strange behavior, but I suspect some is A2K and some might be for me to correct. Just trying to see if anyone can help and advise. We have a database that's been running for a few years...
1
by: itfetish | last post by:
I'm just starting out with ASP.net, making a web parts intranet. I'm triyng to get some basic web parts (ascx files) working on a page, I want them to share a variable, 'StaffID' which one part...
4
by: Michael | last post by:
I am considering building my WebForm page using Web Parts, so that my users can customize Web application's user interface. Is there any good information on it? or step by step demo?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.