Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Beginning ASP.NET 2

.0.pdf
Скачиваний:
23
Добавлен:
17.08.2013
Размер:
24.67 Mб
Скачать

Setup

SQL Server needs Internet access during installation, so please make sure it can access the Internet. Otherwise the installation will fail.

8.At the end of this installation, you should see the screen shown in Figure B-9, asking you to restart your machine. You should oblige by clicking Restart Now.

By chance, you may not see this screen. As a general rule, you shouldn’t restart more often than necessary, so if you’re not prompted to restart, don’t do it.

Figure B-9

9.After your machine has restarted, the dialog depicted in Figure B-10 will be displayed, notifying you of a successful install (or any problems that were encountered) and reminding you to register the software within 30 days.

Figure B-10

10.Click Exit and you will now be able to start up both Visual Web Developer and SQL Express.

659

Appendix B

Web Site Folder Setup

Next, set up the Websites folder with Windows Explorer, and create the folders C:\Websites\ WroxUnited (or use whichever drive is appropriate to your setup).

To create a folder in Windows Explorer, select File New Folder and type in the name Websites.

IIS Setup (Optional)

As we’ve already mentioned, Visual Web Developer Express comes with its own web server, nicknamed Cassini. However, some of you might want to use IIS anyway. To use IIS, you must have Windows XP Professional, Windows 2000, or Windows 2003 Server installed. Windows XP Home Edition comes without IIS, and it isn’t possible to install it on Home Edition if you do manage to get a copy of IIS. To begin the install, follow these steps:

1.To install IIS go to the Start menu, navigate to Settings Control Panel, and click Add or Remove Programs. From the left-hand menu of the dialog (shown in Figure B-11), select the Add/Remove Windows Components icon.

Figure B-11

660

Setup

2.This will bring up the Windows Components Wizard. Make sure the Internet Information Services option is selected, as shown in Figure B-12.

Figure B-12

3.Click Details and you can select which of the options to install (see Figure B-13). You won’t need all of the options, though you can install them separately at a later point. However, you must make sure that you select the Common Files, the IIS snap-in, the Front Page Extensions, and the World Wide Web Services options, because these are necessary to work with ASP.NET 2.0 and Visual Web Developer Express.

Figure B-13

4.Click OK and make sure you have the Windows CD handy for the installation.

661

Appendix B

Create Alias

If you choose to install IIS and want to use the Wrox United sample web site on IIS, you will need to an alias so that IIS can recognize which application you mean and serve it accordingly. The following steps walk you through creating an alias:

1.From the Start menu, select Run, and type MMC in the text box and click OK. In the MMC dialog that appears, select File Add/Remove Snap In. Click the Add button and select IIS Virtual Directory Management from the dialog that appears, as depicted in Figure B-14.

Figure B-14

2.Next, as shown in Figure B-15, expand the IIS Virtual Directory Management. Underneath that will be your computer’s name; expand that as well.

662

Setup

Figure B-15

3.Right-click Default Web Site, and select New Virtual Directory from the menu to start the wizard. Type in WroxUnited as the Virtual Directory Name and C:\Websites\WroxUnited as the local path, as in Figure B-16.

Figure B-16

663

Appendix B

4.Click Apply and then OK, which will finish the wizard. Close the MMC Console. A save is optional; you can supply a name if you so want.

Wrox United Installation

Go to www.wrox.com and search for the dedicated page for Beginning ASP.NET 2.0. Once there, you can download the Wrox United code, which comes as a single downloadable zip file containing the database and application. Download the file WroxUnited.zip and save to the C:\Website\WroxUnited folder you created earlier. Next, unzip this file to C:\Website\WroxUnited. After extraction, you should have 146 files and 5632kb total size. Check with Windows Explorer that inside your C:\WebSites\WroxUnited is an App_Data folder and that it has four files.

In particular, make sure that the following file names are present:

WroxUnited.mdf

ASPNET.mdf

WroxUnited_log.mdf

ASPNET_log.mdf

If not, go back and try downloading the zip file again.

Network Service Enabling

The last step before you can test the application is that you might need to add Write permissions to the Network Service account. This will allow ASP.NET to use the database and to read data from it and write data to it, as routinely required throughout the course of this book. You can skip this step if you are using Windows Server 2003, because the Network Service account has these permissions already enabled by default. If not, then you will almost certainly have to enable Write permissions first. Let’s begin, shall we?

1.To enable Write permissions, go to Windows Explorer and select the C:\WebSites\WroxUnited\ App_Data folder. Right-click it and select Sharing and Security. Select the Security tab, shown in Figure B-17.

664

Setup

Figure B-17

If you can’t see the Security tab this is because you have Simple File Sharing switched on. To disable it select Tools Folder Options from Windows Explorer, and select the View tab. Scroll to the bottom and uncheck the Use Simple File Sharing option (see Figure B-18). If you can’t see the Simple File Sharing option, this is because you have Windows XP Home Edition installed and it has Simple File Sharing switched on permanently, and you cannot change it. Instead, you will have to take another course as outlined in the next section.

665

Appendix B

Figure B-18

2.Click the Add button in the Wrox United Properties dialog and in the Select Users or Groups dialog that appears. Type NETWORK SERVICE into the text box and click Check Names. NETWORK SERVICE will become underlined, as shown in Figure B-19.

Figure B-19

If the machine is joined to a domain, the user must select the Locations button first and pick the current machine, rather than the domain. That’s because NETWORK SERVICE is an account on your machine. By default the dialog will attempt to add the domain name, rather than the machine name.

666

Setup

3.Click OK. You are returned to the Wrox United Properties dialog once more. This time select the new NETWORK SERVICE option. Scroll down and check the box next to Write (see Figure B-20). Click Apply, and then click OK.

Figure B-20

This will enable your account to access the database.

Windows XP Home Edition Users Only

If, when you come to browse for a Security tab in Windows Explorer, you can’t find one, this is because you have Windows XP Home Edition installed and you have a slightly more complex route to enable the correct permissions. Apparently, Windows XP Home Edition users just aren’t allowed to have the same kind of power as their XP Professional counterparts. To get around it, restart your computer in Safe Mode.

To do this, restart your machine, and before the Windows XP logo appears, hold down the F8 key and select Safe Mode. Let XP continue and then log in as Administrator. You’ll receive a warning about running in Safe Mode, but click Yes anyway. Locate the C:\WebSites\WroxUnited folder in Windows Explorer and right-click the App_Data folder. Select Properties and select the Security tab that has now appeared. Now go back to Step 1 in the previous section and follow the instructions from there on. At the end, though, shut down and restart your machine in normal mode before you continue to the next step.

667

Appendix B

Checking the Installation with VWD and Cassini (the Default Web Server)

Once you have successfully downloaded the Wrox United zip file, unzipped it, and enabled the Network Service, you are ready to check your installation:

1.Select the Start menu and navigate to All Programs. Select the Visual Web Developer 2005 Express Edition Icon at the bottom of the menu.

2.VWD will open. Select File Open Web Site, and browse to C:\Websites\WroxUnited and click OK. When the website has loaded into Solution Explorer, Double-click default.aspx to open the file. Last, press the F5 key to run the page and observe in a browser. You should see what appears in Figure B-21 in your browser.

Figure B-21

Checking the Installation with IIS

Follow this step only if you have installed IIS and intend to use it as your main web server. To open WroxUnited with IIS, start Internet Explorer and type http://localhost/WroxUnited into the Address line. The web site should start and display what’s shown in Figure B-22.

668