Monday, June 14, 2010

Visual Studio 2008 - ASP.NET Web DB Application

General Considerations
<<Visual Studio 2008 - Ways to Start a Web Database Application>> intends to offer some approaches in starting to develop internet based database applications.
As I am talking about Microsoft Visual Studio 2008 (VS2008), then the database support ofered in these samples is Microsoft SQL Server Express 2005 (SQLSE2005), as it comes integrated in the VS2008 package. The VS2008 samples here use the SQLSE2005 in a direct way, through a connection string, so we are not talking about N-tier applications or XML Services, aso. The samples intend to offer a way to use the business layer of a web application, so that is why I haven't complicated the access way to the database. The VS2008 samples included uses ASP .NET (framework 3.5 SP1) and they are C# coded behind.

Samples included in <<Visual Studio 2008 - Ways to Start an ASP.NET Web Database Application>>:

Prerequisites:
- MS Windows x86 or 64-bit platform: Win XP SP2, Win Vista, Win 7;
- MS Visual Studio 2008;
- only for the MVC2 framework, you should install VS2008 SP1 and then the MVC2 framework for VS2008 SP1;

Notice:
Before installing VS2008, you have to be sure that you installed on your Windows the Internet Information Service (IIS) which is the Web Server used for the ASP.NET applications to work. To install IIS you need the original kit of Windows, then Start -> Control Panel -> Add or Remove Programs -> Add Remove Windows Components -> check IIS.
The ASP.NET Framework (FX) uses the "ASPNET" Windows user account and for this user the VS2008 installer will configure the IIS, by setting an API (aspnet_isapi.dll) to work with the FX.
Even if you haven't installed the IIS before installing VS2008, there exists a way to post-configure the IIS for FX based applications. The FX 3.5 includes the previous versions of FXs, namely 2.0 and 3.0. The FX 2.0 contains an utilitary to post-configure the IIS. Stop the IIS, then at the command line you type this: [Windows dir]\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe /i; start the IIS and now you should be able to run FX based we applications.
For example, I use Windows XP SP3 with IIS 5.

SQL Server Express 2005 Configuration
The SQL Server included into VS2008 is a lite version; Microsoft decided not to include a visual server manager, such as "Microsoft SQL Server Management Studio Express" (http://www.microsoft.com/downloads/details.aspx?FamilyId=C243A5AE-4BD1-4E3D-94B8-5A0F62BF7796&displaylang=en), and thus, SQLSE2005 may be managed through 2 simple interfaces: "SQL Server Configuration Manager" and "SQL Surface Area Configuration" both interfaces are included in SQLSE2005 distribution of VS2008.
The steps of configuring SQLSE2005 are described here: http://www.petefreitag.com/item/458.cfm, but advanced instructions for SQLSE2005 configuring can be found here: http://www.aspfree.com/c/a/MS-SQL-Server/Configuring-SQL-Server-Express-2005/

Notice:
In general, the SQLSE2005 server should be [computer_name]\SQLEXPRESS. You may use an username/password of a granted SQLSE2005 Windows user or the Windows "Integrated Security" connection.
Make sure you granted the acces for the Windows FX user "ASPNET" in SQLSE2005.

Database Configuration
For these samples I chosen to create an SQLSE2005 database named "dcatalog" that contains 15 tables; 3 of them are system tables: "disk_users" and "disk_roles" are used for the app users and their roles, while the "system_logger" table is used to keep the exceptions (errors and warnings) of the app.
I formed an SQL script for creating the "dcatalog" tables and their records.


In order to use this script, you should firstly create the "dcatalog" database.
Here is the script for creating "dcatalog" tables:
dcatalog.zip

After you created the database and its tables, the database should look as in the next diagram:

Notice: Anyone can design its own database; the "dcatalog" was designed according to my own considerations.
"Ways to Start an ASP.NET Web Database Application" is not intended to be a tutorial, it is more like a case study, from which the VS2008 developer may get an idea to start a web application; in this way, any of the 4 samples has a final section called "conclusion" that describes my conclusion in using the respective approach; of course there are various implementations and there may exist easy ways to implement these samples, but this is the way I chosen to present them and you will have to take them as they are.

2 comments:

  1. I'm having problem with installing the visual studio.The alert msg says "unable to launch setup.exe" though the setup file is available.can u please help.

    ReplyDelete
  2. Hi,
    there are some possibilities:
    1. the "setup.exe" file is damaged;
    2. the "setup.exe" file doesn't find some of its dependency files;
    3. read also this: http://www.vistax64.com/software/157737-visual-studio-2008-pro-unable-launch-setup-exe.html

    ReplyDelete