340 likes | 493 Views
Installation of software and working with web applications using IIS. Phanidhar Mothukuri ID:1 phanidharm0385@uhcl.edu. Introduction. How to download install the files for the text book How to install IIS under Windows 7 or Windows Vista How to install Visual Studio 2010
E N D
Installation of software and working with web applications using IIS PhanidharMothukuri ID:1 phanidharm0385@uhcl.edu
Introduction • How to download install the files for the text book • How to install IIS under Windows 7 or Windows Vista • How to install Visual Studio 2010 • How to install and use SQL Server 2008 Express • How to create the Halloween database • How to use the downloaded web applications • How to create an IIS virtual directory or application • How to set the default page for a web site • How to force a page to use a secure connection • How to work with application pools
How to download and install the files for this book Go to www.murach.com, and go to page for Murach’s ASP.NET 4 Web programming with C# 2010. Click on the link for “FREE download of the book applications.” Then, download “All book files.” Use Windows Explorer to find the downloaded file on your C drive. Then, double-click on this file and respond to the dialog boxes that follow. This installs the files in directories that start with C:\Murach\aspnet4_cs.
How to install IIS under windows 7 Display the Control panel and click the Programs link. Then, click the Turn Windows Features On or Off link in the Programs and Features category to display the windows Features dialog box. Select Internet Information Services from the list of features that are displayed. Expand the Internet Information service nodes and make sure to select these features: Web Management Tools IIS 6 Management Compatibility Web Management Tools IIS Management Console World Wide Web Services Application Development Features ASP.NET
If you want to configure IIS as an FTP server, expand the Internet Information Services node and select the FTP Server feature. Click the OK button to complete the installation.
How to install visual studio 2010 Insert the Disc of the installation CDs. The setup program will start automatically. Click the install Microsoft Visual Studio 2010 link and follow the instructions. When the options page is displayed, you can accept the Full option unless you have special requirements. When the Finish page is displayed, you can click the install documentation button to install the visual studio documentation on your local system. To install any updates that are available, click the Check for service Releases link.
How to install and use SQL Server 2008 Express Edition • Run the setup program. • Select the “new installation or add feature to an existing installation” option to start the SQL Server 2008 R2 Setup Wizard, and respond to the resulting dialog boxes. • At the Feature Selection step, select all available features .
At the Instance Configuration step, create a named instance with a name of SQLEXPRESS. • At the sever configuration step, select NTAUTHORITY\SYSTEM as the account name for the SQL server database engine service to run SQL server on your computer.
At the Database Engine Configuration step, you can accept the default setting of Windows Authentication Mode. • You can also click the Add Current User button to add the current user as a SQL Server administration.
How to create the Halloween database To create the Halloween database, you can use Windows Explorer to navigate to the C:\Murach\aspnet4_cs\database folder and double click the create_database.bat file. This runs the create_database.sql file that creates the database objects and inserts the rows into each table.
The create_database.sql file starts by deleting the Halloween database if it already exists. That way, you can use it to recreate the database and restore the original data if you ever need to do that. • When you create the Halloween database, two files named Halloween.mdf and Halloween_log.ldf are created and stored in the default data directory for your instance of SQL Server. For SQL Server 2008, for example, that directory is C:\Programfiles\Microsoft SQL Server\MSSQL10.SQLEXRESS\MSSQL\DATA.
How to use the downloaded web application You can use two techniques to run the downloaded web applications for this book. You can open the applications in Visual Studio and then run them using the built-in development server. You can run them under a local IIS server. Before you can run an application under a local IIS server, you must create a virtual directory for the application within IIS. A virtual directory is a directory that contains a pointer to the directory that actually contains the files for a web site. How to create a virtual directory??
But first, if you're using Windows 7, you should set the application pool that IIS will use when you create a virtual directory for an existing application from Visual Studio. To do that, you use the IIS Management Console. • Once you create a virtual directory for a web application, you can also run the application from outside of Visual Studio. To do that, open a browser window and specify //localhost/ followed by the virtual directory name and the starting page
For example, if the virtual directory name is “halloweenexample” and the starting page is cart.aspx, you can run the application by • Entering //localhost/halloweenexample/cart.aspx in the browser's address bar.
How to run a file-system web site under the development web server Start Visual Studio and open the web site using the File-»Open Web Site command. Right-click the starting page for the application and select Set As Start Page. Run the application using the Debug-�Start Debugging command.
How to run a file-system web site under IIS Start Visual Studio and display the New Web Site dialog box using the File-»New Web Site command. Click the Browse button to display the Choose Location dialog box.
Select the Local IIS button at the left side of the dialog box, select the Default Web Site node (or a directory that's subordinate to that node) from the tree that's displayed, and then click the Create New Virtual Directory button near the upper right corner of the dialog box. This displays the New Virtual Directory dialog box.
Enter the name for the virtual directory you want to create, enter the path where the files for the web site are stored, and click OK to return to the Choose Location dialog box. • Select the virtual directory you just created, and click Open to return to the New Web Site dialog box. • Click OK. A warning will be displayed indicating that there is already a web site at the location you specified. Select the Open the Existing Web Site option, and click OK. • Right-click the starting page for the application and select Set As Start Page. • Run the application using the Debug-»Start Debugging command.
How to create an IIS virtual directory for a file-system web site Open the Control Panel, click the System and Security link, followed by the Administrative Tools link. Then, double-click Internet Information Services (IIS) Manager to openthe IIS Management Console. Use the tree to locate the Default Web Site node, right-click Default Web Site (or adirectory that's subordinate to that node), and choose Add Virtual Directory to displaythe Add Virtual Directory dialog box. Enter the name you want to use for the virtual directory, enter the path for the directorythat contains the web site, and click the OK button.
Two ways to create an IIS application for a file-system web site If a virtual directory already exists for the web site, right-click on it, select Convert toApplication, select an application pool from the Add Application dialog box that'sdisplayed, and click OK. If a virtual directory doesn't exist for the web site, use the procedure above for creating avirtual directory, but choose Add Application to display the Add Application dialog boxand select an application pool in addition to entering a name.
How to set the default page for a web site • To run a web application from outside of Visual Studio, you typically enterthe URL of the application and the starting page in a browser. If you don't entera starting page, however, IIS will look for a page with a name in the defaultdocument list for the application. • The last file name in the default document list,default.aspx, is the default name of the first page added to a new ASP.NET web site from Visual Studio. Ifyou don't change the name of this page, you don't need to change the defaultdocument list.
How to force a page to use a secure connection • In chapter 18, you can learn how to secure a web application. One aspect ofsecuring an application that's covered in that chapter is how to be sure that apage that should always use a secure connection can't be displayed without one. • The technique shown in that chapter involves adding code to the Load eventprocedure of the page. That way, if a user tries to bypass the navigation featuresprovided by an application and access a page directly, the page will still besecured. • Another way to provide that security is to use the IIS ManagementConsole.
How to set the security for a web page • Display the IIS Management Console, and then locate and select the web site thatcontains the page you want to secure. • Click the Content View tab on the Home page for the web site, select the page you wantto secure, and then click the Switch to Features View link in the Actions pane. • Double-click SSL Settings in the IIS group of the Home page to display the SSL Settings page. Then, select the Require SSL option.
How to work with application pools • After you install ASP.NET 4, four application pools will be defined for IIS. To displaythese pools, click the Application Pools node in the Connections pane. • If you create a new IIS application or virtual directory from Visual Studio, it's assignedto an application pool based on the target framework you specify. If you create an IISapplication from the IIS Management Console, you specify the pool you want to use. • To add an application pool, click the Add Application Pool link in the Actions Pane todisplay the dialog box shown above. Then, enter a name for the pool, select the .NETFramework the application uses, and click OK.
To change the application pool that an application runs in, select the application in theConnections pane, click the Basic Settings link in the Actions pane, click the Selectbutton in the Edit Application dialog box that's displayed, and select the pool from theApplication Pool drop-down list. • To change the default application pool for the server, select the Default Web Site nodeinstead of a specific application. • You can also perform a variety of operations on individual application pools by selectinga pool in the Application Pool page and then using the links in the Action pane.