configuring windows server

50
CONFIGURING WINDOWS SERVER MIS 424 Professor Sandvig

Upload: river

Post on 23-Feb-2016

114 views

Category:

Documents


0 download

DESCRIPTION

Configuring Windows Server. MIS 424 Professor Sandvig. Overview . In this exercise you will: Log onto Windows Server Create a new application pool Create a new web application Open Sql Server Management Studio Create a new Sql Server database Create a new Sql Server user - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Configuring Windows Server

CONFIGURING WINDOWS SERVER

MIS 424Professor Sandvig

Page 2: Configuring Windows Server

Overview • In this exercise you will:

1. Log onto Windows Server2. Create a new application pool3. Create a new web application4. Open Sql Server Management Studio5. Create a new Sql Server database6. Create a new Sql Server user7. Assign the user to the database8. Read your database from web page

Page 3: Configuring Windows Server

Steps• You will be provided with an instance of Windows Server

2008 hosted by on Amazon EC2 cloud• The next two slides display how an instance is launched

from Amazon’s console

Page 4: Configuring Windows Server

Amazon Web Service Console

Page 5: Configuring Windows Server

Select instance type

Page 6: Configuring Windows Server

Instance• Each instance is assigned a public IP address• The following slide shows the instance management page

Page 7: Configuring Windows Server

Instance Management

Page 8: Configuring Windows Server

Instance Management• Next step is to get the instance password

Page 9: Configuring Windows Server

Instance management

Page 10: Configuring Windows Server

Password• Amazon generates a private key for each account. • The private key is used to decrypt the password (next

slide)

Page 11: Configuring Windows Server

Password

Page 12: Configuring Windows Server

Password• Ta-da!

Page 13: Configuring Windows Server

Login• Login to your instance using Remote Desktop• Your IP address and password are on the next page

Page 14: Configuring Windows Server

Login Passwords

Person IP username password

Zak 52.26.27.211 Administrator ;w2AERmyC8@

Chris 52.26.29.83 Administrator tZ)cKM=H4i

Lindsey 52.26.80.27 Administrator LFwWYV;ibd

Alastair 52.26.83.25 Administrator ;HszTDR==S$

Ryan 52.26.77.0 Administrator ChivDyNrD3$

Alex 52.26.20.118 Administrator n4@*4yVCRMi

Hayley 52.26.47.120 Administrator F5ZcRU.Yq-

Jason 52.26.62.131 Administrator n@*33-M4d$W

Alicia 52.26.83.45 Administrator T5&*8v=cm6

Daniel 52.26.83.253 Administrator ULxxtxDYF7

Taylor 52.26.70.144 Administrator *sTMkgNcPH-

Page 15: Configuring Windows Server

View IIS Default• By default Windows

hides file extensions• Developers need to

see file extensions.• Navigate to the IIS

root web folder• Change folder

options to show file extensions

Page 16: Configuring Windows Server

Permissions• While in the IIS root folder,

check folder permissions.• Which permissions are

assigned to anonymous web users?

Page 17: Configuring Windows Server

View default web page• Open browser on your local machine and view IIS default

web page• Address is IP address of your instance

Page 18: Configuring Windows Server

Modify default web page• Use Notepad to edit the default web page

Page 19: Configuring Windows Server

Create ASP.NET Application• You will now use IIS to create a new ASP.NET application.

Page 20: Configuring Windows Server

Create a ASP.NET Application• Create a new folder named mis424Application

Page 21: Configuring Windows Server

Create ASP.NET Application• Search for IIS using

Windows search • Open IIS 7.0 Manager

Page 22: Configuring Windows Server

Create a new application pool• Your application is important so provide it with its own

application pool

Page 23: Configuring Windows Server

New Application pool• Give the application pool the same name as the

application folder• Change framework to 4.0

Page 24: Configuring Windows Server

Create new Application• Right click on your new folder

and convert it to an application

• Select your new application pool

Page 25: Configuring Windows Server

Test your application• Use Notepad to create a file default.aspx with the

following code: <%@ Page Trace="true" Language="C#" %>

<script runat="server"> void page_load() { lblMessage.Text = ".NET Version: " + System.Environment.Version.ToString() +

"<br> Application Pool: " + Request.ServerVariables["APP_POOL_ID"] ; }</script>

<html><head> <title>ASP.NET Test</title></head><body> <asp:label id="lblMessage" runat="server" /></body></html>

Page 26: Configuring Windows Server

View new File

Page 27: Configuring Windows Server

Database• You have now configured an ASP.NET application• The next step is to create a new SQL server database

and link to it from your web application.

Page 28: Configuring Windows Server

Create a new database• Open Sql Server

Management Studio on the remote server

Page 29: Configuring Windows Server

Connect to Sql Server

• Management Studio will automatically select your database server

• Click “Connect”

Page 30: Configuring Windows Server

Create new database• Name your new database “customers”

Page 31: Configuring Windows Server

Create a new table (as shown)

Page 32: Configuring Windows Server

Create new table• You will be connecting an .aspx page to your database

so make sure that all the names match the sample• Sql Server is case sensitive• custID is an identity field• custID is the primary key• Table name is tblCustomers

Page 33: Configuring Windows Server

Add some data

Page 34: Configuring Windows Server

Permissions• Permissions are needed to access the database• You will create a new user named Webguest • For security reasons Webguest has only limited

permissions• In the following steps you will:

1. Configure Sql Server to allow Sql server authentication

2. create a new Sql Server user3. Assign user permissions to your database

Page 35: Configuring Windows Server
Page 36: Configuring Windows Server

Allow Sql Server Authentication• Using Sql Server

Management Studio right-click on the database server (top folder) and and select Properties

• Click on Security• Change authentication

mode

Page 37: Configuring Windows Server

Restart Database• In Management Studio right-

click on server and select restart

Page 38: Configuring Windows Server

Add new Sql Server user

Page 39: Configuring Windows Server

Add Sql user• Username:

Webguest• Password:

guest22• Turn off “enforce

password policy”

Page 40: Configuring Windows Server

Assign user to customers database

• Open Customers database

• Open Security• Right-click “Users”• Select “New User

Page 41: Configuring Windows Server

Assign Roles on Database• Username and

Login name is “Webguest”

• Assign limited roles: datareader and datawriter

Page 42: Configuring Windows Server

Test login• Create a second

connection to database in SSMS.

• Login to server using Sql Server Authentication

• You now have two connections to database. One as an admin, one as Webguest

Page 43: Configuring Windows Server

Test permissions• Try to view, add, update,

and delete data• Try to add a new table

Page 44: Configuring Windows Server

Connect Web to Database• Create a new file

crud.aspx using this code

• Replace data source with your database name from Sql Server Studio

<%@ Page Language="C#" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title>Read Sql Server</title> <style type="text/css"> table {margin:10px auto; background-color:#fff;} td {padding:5px;} body {background-color:#ccc;}

</style></head><body> <form id="form1" runat="server"> <div style="text-align:center;"> <h1>Read Sql Server</h1><hr /> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="custID" DataSourceID="SqlDataSource1"> <Columns> <asp:CommandField ShowEditButton="True" /> <asp:BoundField DataField="custID" HeaderText="custID" InsertVisible="False" ReadOnly="True" SortExpression="custID" /> <asp:BoundField DataField="name" HeaderText="name" SortExpression="name" /> </Columns> </asp:GridView> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Data Source=win-vuc09id4k05;Initial Catalog=customers;User ID=Webguest;Password=guest22" DeleteCommand="DELETE FROM [tblCustomers] WHERE [custID] = @custID" InsertCommand="INSERT INTO [tblCustomers] ([name]) VALUES (@name)" ProviderName="System.Data.SqlClient" SelectCommand="SELECT [custID], [name] FROM [tblCustomers]" UpdateCommand="UPDATE [tblCustomers] SET [name] = @name WHERE [custID] = @custID"> <DeleteParameters> <asp:Parameter Name="custID" Type="Int32" /> </DeleteParameters> <InsertParameters> <asp:Parameter Name="name" Type="String" /> </InsertParameters> <UpdateParameters> <asp:Parameter Name="name" Type="String" /> <asp:Parameter Name="custID" Type="Int32" /> </UpdateParameters> </asp:SqlDataSource> </div> </form></body></html>

Page 45: Configuring Windows Server

Test CRUD

Page 46: Configuring Windows Server

Email links• Email your Amazon cloud links to Professor Sandvig:

1. default.aspx2. Crud.aspx

Page 47: Configuring Windows Server

Summary• Today you have:

1. Logged onto Windows Server2. Created a new application pool3. Created a new web application4. Used Sql Server Management Studio to:

a. Create a new databaseb. Create a new userc. Assign the user to the databased. Log in as the new user

5. Read your database from an .aspx application

Page 48: Configuring Windows Server

Other things you could do:• Create your own Amazon EC2 instance (free but requires

a credit card)• Copy your MIS 324 / MIS 424 assignments to Amazon• Setup a CMS

• Download Microsoft Web Platform Installer• Select a CMS (see next page)

Page 49: Configuring Windows Server

Web Platform Installer

Page 50: Configuring Windows Server

Finished