Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: ASP.NET Website Programming Problem-Design-Solution
This is the forum to discuss the Wrox book ASP.NET Website Programming: Problem - Design - Solution, Visual Basic .NET Edition by Marco Bellinaso, Kevin Hoffman; ISBN: 9780764543869
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET Website Programming Problem-Design-Solution section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old October 24th, 2006, 02:07 PM
Authorized User
 
Join Date: Feb 2006
Location: , , .
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default ThePhile project installation

Hi All.
I have machine with Framework .NET 1.1, Visual Studio .NET 2003 and SQL Server 2000.
According Readme.html file I did configuration of my machine. When I done and click link http://localhost/thephileVB I got an error:

 
Quote:
quote:Error
Quote:

----------------------------------------------------------------------
An unexpected error has occurred on this page.The system administrators have been notified.

The error occurred in:
http://localhost/thephileVB/Default.aspx

Error Message:
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)

Error Stack:
System.Data.SqlClient.SqlException: 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)
   at System.Data.SqlClient.SqlInternalConnection.OnErro r(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndW arning(TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.Connect(Boolean& useFailoverPartner, Boolean& failoverDemandDone, String host, String failoverPartner, String protocol, SqlInternalConnectionTds connHandler, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject, Boolean aliasLookup)
   at System.Data.SqlClient.SqlInternalConnectionTds.Ope nLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
   at System.Data.SqlClient.SqlInternalConnectionTds..ct or(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
   at System.Data.SqlClient.SqlConnectionFactory.CreateC onnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
   at System.Data.ProviderBase.DbConnectionFactory.Creat ePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
   at System.Data.ProviderBase.DbConnectionPool.CreateOb ject(DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionPool.UserCrea teRequest(DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionPool.GetConne ction(DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionFactory.GetCo nnection(DbConnection owningConnection)
   at System.Data.ProviderBase.DbConnectionClosed.OpenCo nnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
   at System.Data.SqlClient.SqlConnection.Open()
   at Wrox.WebModules.Data.DbObject.RunProcedure(String storedProcName, IDataParameter[] parameters, Int32& rowsAffected) in C:\wrox\ThePhileVB\WebModules\Core\DBObject.vb:lin e 53
   at Wrox.WebModules.Polls.Data.Questions.GetCurrentId( ) in C:\wrox\ThePhileVB\WebModules\Polls\Polls.Data\Que stions.vb:line 158
   at Wrox.WebModules.Polls.Business.Question.GetCurrent Id() in C:\wrox\ThePhileVB\WebModules\Polls\Polls.Business \Question.vb:line 227
   at Wrox.WebModules.Polls.Web.Controls.User.Poll.DataB ind() in C:\wrox\ThePhileVB\WebModules\Polls\Poll.ascx.vb:l ine 260
   at Wrox.WebModules.Polls.Web.Controls.User.Poll.Page_ Load(Object sender, EventArgs e) in C:\wrox\ThePhileVB\WebModules\Polls\Poll.ascx.vb:l ine 62
   at System.Web.UI.Control.OnLoad(EventArgs e)
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)


Please, help to solve the problem. Thanks.
  #2 (permalink)  
Old October 24th, 2006, 06:17 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Atlanta, Georgia, USA.
Posts: 917
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Did you read the error message - it says you're trying to connect to Sql Server 2005. That should work fine for this book, by the way, assuming you know how to port the database and connect to it.

It's VS 2005 that isn't easily compatible with this project. All versions of Sql Server 2005 should be fine (even the free Express version).

You need to decide how you want to connect to it, and enable that protocol. It sounds like you're trying to use TCP/IP, which defaults off. Check the Sql Server Configuration Manager.

Maybe you have more than 1 version of Sql Server installed, but only one can be an unnamed instance and that's the one you're using if you didn't specify an instance name in your connection string.

Eric

  #3 (permalink)  
Old October 25th, 2006, 08:54 AM
Authorized User
 
Join Date: Feb 2006
Location: , , .
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks englere. Hi All.

At the buttom of readme.html file I found problem that I had at the beginning.
Quote:
quote:The error occurred in:
http://localhost/thephileVB/Default.aspx

Error Message:
Access to the path 'C:\wrox\ThePhileVB\Config\Polls.Config' is denied.
Then I made changes in Polls.Configuration. That help I found in readme file:
Quote:
quote:You need to modify the FileStream constructors in the ModuleConfig.vb or ModuleConfig.cs files as described below.

Users with VB.NET version of Code

Dim fs As New FileStream(fileName, FileMode.Open, FileAccess.Read)
After changes and rebuid solution was done I got other message:
Quote:
quote:The error occurred in:
http://localhost/thephileVB/Default.aspx

Error Message:
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)
Thanks for any help.
  #4 (permalink)  
Old October 25th, 2006, 06:19 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Atlanta, Georgia, USA.
Posts: 917
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Please read every word of your error message, and then read my earlier reply. Sql Server and .NET often give you a good summary of the problem if you read it carefully.

  #5 (permalink)  
Old October 26th, 2006, 10:50 AM
Authorized User
 
Join Date: Feb 2006
Location: , , .
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks englere for replay.
I read message line by line, open according files in Visual Studio .NET but cannot figure out what need to do. Why project try to connect to SQL Server 2005 if my machine has only SQL Server 2000. I will very appreciate if you detially explaine what steps need to execute to solve that problem.
Thanks.

  #6 (permalink)  
Old October 26th, 2006, 06:50 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Atlanta, Georgia, USA.
Posts: 917
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'd have to check your computer, but you can do that easier than me. How do you connect to your database using Query Analyzer? Is your connection string right? Do you have the Sql Server Configuration Manager on your start menu (which is a SQL 2005 utility)?

You may need a book on Sql Server because it's hard for me to teach you all about it here.

Eric

  #7 (permalink)  
Old October 27th, 2006, 05:24 PM
Authorized User
 
Join Date: Feb 2006
Location: , , .
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi englere.
I saw Server Configuration Manager it is utilitie related to SQL Server 2005 Sql. On my computer I have only SQL Server 2000. I can connect to Query Analyzer by some ways:
1. Start->All Programs->MS SQL Server->Query Analizer;
2. Start->All Programs->MS SQL Server->Enterprise Manager->Query Analizer.
What is your oppinion?
When I going to Control Panel->Administrative Tools->open IIS->open Properties Default Web Site will see ASP .NET tag. In my computer ASP.NET version combo box show me two versions: 2.0.50727 is default and 1.1.4322.
File location is c:\inetpub\wwwroot\web.config.
But when I open Web Sides properties ASP.NET tag has the same versions.
File location: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\conf ig\web.config
May be for project of this book need setup in properties other ASP version. If so what need to do with File location: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\conf ig\web.config.
If I'm correct. What steps of setup I need to do? Please, give me detail explanations.
Thanks.
  #8 (permalink)  
Old October 28th, 2006, 07:58 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Atlanta, Georgia, USA.
Posts: 917
Thanks: 0
Thanked 0 Times in 0 Posts
Default

look in Admin tools, services. Tell me if you see MSSQLSERVER or SQL Server, or both?

Can you connect to your DB using Query Analyzer? Do you have ThePhile database loaded? If not, there's no way you can use the site.

I really can't teach you how to use SQL Server. You have to learn that before you can use ThePhile.

  #9 (permalink)  
Old October 30th, 2006, 11:35 AM
Authorized User
 
Join Date: Feb 2006
Location: , , .
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi englere. Thanks for your replays.
In Admin tools, services I have:
Name | Description | Status | Start up | Log on as
-----------------+---------------+----------+-----------+------------------
MSSQLSERVER | | Started | Automatic | Local System
----------------------------------------------------------------------------
SQLSERVERAGENT| | | Manual | Local System
----------------------------------------------------------------------------
Then I open Interprise Manager to check about ThePhile database and open Query Analizer. Then create query just for case:
select *
from dbo.News_News
where CategoryID = 1
The result is:
Quote:
quote:1 1 The Simpsons: the final collection. Great deal A huge collection of The Simpsons episodes. 101 for the sake of accuracy! PAST NEWS 2001-10-10 00:00:00.000 2001-10-20 00:00:00.000 2001-10-19 23:32:06.180 1 2
2 1 The Simpsons: the final collection. Great deal A huge collection of The Simpsons episodes. 101 for the sake of accuracy! CURRENT NEWS!!! 2001-10-10 00:00:00.000 2001-10-28 00:00:00.000 2001-10-19 23:32:17.977 1 2
4 1 The Simpsons - The Movie Eh si amici telespettatori, da non credeci eh?? CURRENT NEWS 2001-10-10 00:00:00.000 2099-01-01 00:00:00.000 2001-10-21 14:14:25.323 1 2
5 1 Matrix III in DVD - read everything about it! I'm still waiting for Matrix II in reality... 2001-10-21 00:00:00.000 3000-01-01 00:00:00.000 2001-10-21 19:07:36.507 1 2
15 1 Guess what... another test...routine for me! 2001-10-05 00:00:00.000 3000-01-01 00:00:00.000 2001-10-24 01:47:57.213 0 2
22 1 THIS IS A TEST I've tested it, and now I'm happy! 2001-10-26 00:00:00.000 3000-01-01 00:00:00.000 2001-10-26 20:37:02.037 0 2
Like you can see I have ThePhile database, my SQL Server 2000 also is working.
Thanks, will wait other idea.

  #10 (permalink)  
Old October 31st, 2006, 12:06 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Atlanta, Georgia, USA.
Posts: 917
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You don't have SQL 2005 but you must have referenced a DLL for it by mistake (System.Data.SqlClient). Check your references to make sure you are using the version 1.1 DLLs.

Also, make a console app to test your connection string - if this shows your tables then your connection string is fine. If not, maybe you don't have Sql Server listening on the normal TCP port, or maybe there's a firewall in the middle?

using System;
using System.Data;
using System.Data.SqlClient;

namespace ConnectTest
{
  class ConnectTestClass
  {
    static void Main(string[] args)
    {
      try
      {
        string conStr = @"server=(local);database=ThePhile;uid=ThePhileUse r;pwd=password;";
        SqlConnection con = new SqlConnection(conStr);
        con.Open();

        Console.WriteLine("Tables in the database:");

        // This SQL lists the tables in the DB
        String sqlStr = "select name from sysobjects where type='U'"
          + " and name not like 'dt%' order by name";

        SqlCommand cmd = new SqlCommand(sqlStr, con);
        SqlDataReader dr;
        try
        {
          dr = cmd.ExecuteReader();

          while (dr.Read())
          {
            Console.WriteLine("{0}", dr.GetString(0));
          }
        }
        finally
        {
          dr.Close();
          con.Close();
        }
      }
      catch (Exception ex)
      {
        Console.WriteLine("Exception: " + ex.Message);
      }
      Console.Write(Environment.NewLine + "Press Return ...");
      Console.ReadLine();
    }

  }
}







Similar Threads
Thread Thread Starter Forum Replies Last Post
ThePhile.sln project installation & Execution help monir75 BOOK: ASP.NET Website Programming Problem-Design-Solution 1 October 16th, 2006 08:18 AM
Installation for VB project pavel Pro VB 6 0 April 13th, 2006 09:32 AM
Installing thePhile Database help glabana BOOK: ASP.NET Website Programming Problem-Design-Solution 2 January 11th, 2006 12:19 PM
Error while running/executing project thePhile seetha_l BOOK: ASP.NET Website Programming Problem-Design-Solution 0 June 11th, 2004 11:31 AM
keep getting an error with ThePhile ar3ol BOOK: ASP.NET Website Programming Problem-Design-Solution 15 February 4th, 2004 01:19 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.