CONFIGURING WINDOWS SERVER MIS 424 Professor Sandvig Overview

  • Slides: 58
Download presentation
CONFIGURING WINDOWS SERVER MIS 424 Professor Sandvig

CONFIGURING WINDOWS SERVER MIS 424 Professor Sandvig

Overview • In this exercise you will: 1. Log onto Windows Server 2. Create

Overview • In this exercise you will: 1. Log onto Windows Server 2. Create a new application pool 3. Create a new web application 4. Open Sql Server Management Studio 5. Create a new Sql Server database 6. Create a new Sql Server user 7. Assign the user to the database 8. Read your database from web page

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

Steps • You will be provided with an instance of Windows Server 2016 hosted by on Amazon EC 2 cloud • The next several slides display how an instance is launched from Amazon’s console. These steps have already been done for you.

Amazon Web Service Console

Amazon Web Service Console

Select instance type

Select instance type

Instance • Each instance is assigned a public IP address • The following slide

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

Instance Management

Instance Management

Security Group • Instance security group must be modified to allow inbound request from

Security Group • Instance security group must be modified to allow inbound request from port 80

Instance Management • Next step is to get the instance password

Instance Management • Next step is to get the instance password

Instance management

Instance management

Password • Amazon generates a private key for each account. • The private key

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

Password • Ta-da!

Password • Ta-da!

Login • Login to your instance using Remote Desktop • Your Public DNS and

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

Login Passwords Username: Administrator Person Kalen Alex Kevin Dillon Public DNS ec 2 -35

Login Passwords Username: Administrator Person Kalen Alex Kevin Dillon Public DNS ec 2 -35 -173 -220101. compute 1. amazonaws. com ec 2 -54 -159 -157200. compute 1. amazonaws. com ec 2 -34 -203 -215 -7. compute 1. amazonaws. com ec 2 -54 -174 -155155. compute 1. amazonaws. com Password (cut & paste) (Me&M$@Gd. ED 7!iz@jqwi&RAS; B% LVWT o*K%@bs. JX)x. Vl. YTAD 2 mfd. =W MBqlyup. L 9 J? JCOu 3 LQid? 89 Md. Hae 3 m. Zr Jb 83 Ep 3( %g. Rjf. Bquh. A? t. K$LBYFdzn 5 Gm HEzi. NKD!

Server Configuration • The next two steps change server settings to improve usability

Server Configuration • The next two steps change server settings to improve usability

View IIS Default • By default Windows hides file extensions • Developers need to

View IIS Default • By default Windows hides file extensions • Developers need to see file extensions. • In Windows Explorer select “Local Disk C”, View tab, Options, View, uncheck “Hide extensions…” • Change folder view to show file extensions

Turn off IE Enhanced Security • Open Server Manager, select “Local Server, turn off

Turn off IE Enhanced Security • Open Server Manager, select “Local Server, turn off IE Enhanced Security for Administrators.

Install IIS • By default only minimal server services are installed (to minimize attach

Install IIS • By default only minimal server services are installed (to minimize attach surface) • Open Server Manager, select Local Server, Manage, Add Roles and Features

Install IIS • Click each menu option down to “Server Roles” • Select “Web

Install IIS • Click each menu option down to “Server Roles” • Select “Web Server (IIS)

Install IIS • Check ASP. NET 4. 6 and others as shown below

Install IIS • Check ASP. NET 4. 6 and others as shown below

Task Manager • IIS takes a few minutes to install • Start Task Manager

Task Manager • IIS takes a few minutes to install • Start Task Manager to monitor progress

Install IIS • Confirm IIS installation by checking for a new folder named “inetpub/wwwroot”

Install IIS • Confirm IIS installation by checking for a new folder named “inetpub/wwwroot” • wwwroot is the web server root folder • Iisstart. htm is the default web page

Permissions • Navigate to wwwroot and check folder permissions. • IIS_IUSERS is the user

Permissions • Navigate to wwwroot and check folder permissions. • IIS_IUSERS is the user assigned to anonymous internet users. • It is a limited account with only read and execute permissions

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

View default web page • Open a browser on your local machine and view the default IIS web page • URL is public IP of your instance (on server desktop)

Make new default web page • Copy iisstart. htm to default. htm • Use

Make new default web page • Copy iisstart. htm to default. htm • Use Notepad to edit default. htm <body> <div id="container"> <h 1>Hello world!</h 1> </div> </body>

Create a ASP. NET Application • You will now create a new ASP. NET

Create a ASP. NET Application • You will now create a new ASP. NET application. • Create a new folder named mis 424 Application

Create ASP. NET Application • Open IIS Manager • Start, Administrative Tools, IIS Manager

Create ASP. NET Application • Open IIS Manager • Start, Administrative Tools, IIS Manager

Create a new application pool • Create an application pool for your application

Create a new application pool • Create an application pool for your application

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

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

Create new Application • In IIS manager right click on your new folder and

Create new Application • In IIS manager right click on your new folder and convert it to an application • Select your new application pool

Test New Application • In the next step you will create a simple. aspx

Test New Application • In the next step you will create a simple. aspx page that displays information about your application.

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

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() { lbl. Message. Text = ". NET Version: " + System. Environment. Version. To. String() + " Application Pool: " + Request. Server. Variables["APP_POOL_ID"] ; } </script> <html> <head> <title>ASP. NET Test</title> </head> <body> <h 2 style="text-align: center"> <asp: label id="lbl. Message" runat="server" /> </h 2> </body> </html>

View new file in local browser

View new file in local browser

Database • You have now configured an ASP. NET application! • The next step

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.

Create a new database • Open Sql Server Management Studio on the server (under

Create a new database • Open Sql Server Management Studio on the server (under SQL Server Tools) • Check host/server name (starts with ec 2 amaz)

Create new database • Name your new database “Retail. Store”

Create new database • Name your new database “Retail. Store”

Add a new table (as shown) cust. ID is the primary key and identity

Add a new table (as shown) cust. ID is the primary key and identity field

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

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 Save the table with name tbl. Customers

Add some data (3+ rows)

Add some data (3+ rows)

Permissions • Permissions are needed to access the database • You will create a

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 user 3. Assign user permissions to your database

Allow Sql Server Authentication • Using Sql Server Management Studio right-click on the database

Allow Sql Server Authentication • Using Sql Server Management Studio right-click on the database server (top folder) and select Properties • Click on Security • Change authentication mode

Restart Database • In Management Studio right- click on server and select restart

Restart Database • In Management Studio right- click on server and select restart

Add new Sql Server user

Add new Sql Server user

Add Sql user • Username: webguest • Password: guest 22 • Turn off “enforce

Add Sql user • Username: webguest • Password: guest 22 • Turn off “enforce password policy”

Assign user to Retail. Store database • Open Security • Right-click “Users” • Select

Assign user to Retail. Store database • Open Security • Right-click “Users” • Select “New User

Assign Roles on Database • Username and Login name is “webguest” • Click default

Assign Roles on Database • Username and Login name is “webguest” • Click default schema • Click browse • Check db_datareader

Assign Permissions on table • Right-click tbl. Customers and select Properties • Select Permissions

Assign Permissions on table • Right-click tbl. Customers and select Properties • Select Permissions • Click search, click browse, select webguest • Click “Select” permission

Test login • Create a second connection to database in SSMS. • Login to

Test login • Create a second connection to database in SSMS. • Login to server using Sql Server Authentication (webguest / guest 22) • You now have two connections to database. One as an admin, one as webguest

Test permissions • Try to view, add, update, and delete data • Try to

Test permissions • Try to view, add, update, and delete data • Try to add a new table

Connect Web to Database • In the mis 424 Application folder create a new

Connect Web to Database • In the mis 424 Application folder 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> <head runat="server"> <title>Read Sql Server</title> <style type="text/css"> table {margin: 10 px auto; background-color: #fff; } td {padding: 5 px; } body {background-color: #ccc; } </style> </head> <body> <form id="form 1" runat="server"> <div style="text-align: center; "> <h 1>Read Sql Server</h 1><hr /> <asp: Grid. View ID="Grid. View 1" runat="server" Auto. Generate. Columns="False" Data. Key. Names="cust. ID" Data. Source. ID="Sql. Data. Source 1"> <Columns> <asp: Command. Field Show. Edit. Button="True" /> <asp: Bound. Field Data. Field="cust. ID" Header. Text="cust. ID" Insert. Visible="False" Read. Only="True" Sort. Expression="cust. ID" /> <asp: Bound. Field Data. Field="name" Header. Text="name" Sort. Expression="name" /> </Columns> </asp: Grid. View> <asp: Sql. Data. Source ID="Sql. Data. Source 1" runat="server" Connection. String="Data Source=ec 2 amaz-ide 9 no 7; Initial Catalog=Retail. Store; User ID=webguest; Password=guest 22" Delete. Command="DELETE FROM [tbl. Customers] WHERE [cust. ID] = @cust. ID" Insert. Command="INSERT INTO [tbl. Customers] ([name]) VALUES (@name)" Provider. Name="System. Data. Sql. Client" Select. Command="SELECT [cust. ID], [name] FROM [tbl. Customers]" Update. Command="UPDATE [tbl. Customers] SET [name] = @name WHERE [cust. ID] = @cust. ID"> <Delete. Parameters> <asp: Parameter Name="cust. ID" Type="Int 32" /> </Delete. Parameters> <Insert. Parameters> <asp: Parameter Name="name" Type="String" /> </Insert. Parameters> <Update. Parameters> <asp: Parameter Name="name" Type="String" /> <asp: Parameter Name="cust. ID" Type="Int 32" /> </Update. Parameters> </asp: Sql. Data. Source> </div> </form> </body> </html>

Modify Connection String • Edit Data Source to match your Host: • Connection. String="Data

Modify Connection String • Edit Data Source to match your Host: • Connection. String="Data Source=ec 2 amaz-bjlfrve

Test CRUD

Test CRUD

Email links • Email your Amazon cloud links to Professor Sandvig: 1. default. aspx

Email links • Email your Amazon cloud links to Professor Sandvig: 1. default. aspx 2. Crud. aspx

Summary • Today you have: 1. Logged onto Windows Server 2. Created a new

Summary • Today you have: 1. Logged onto Windows Server 2. Created a new application pool 3. Created a new web application 4. Used Sql Server Management Studio to: a. b. c. d. 5. Create a new database Create a new user Assign the user to the database Log in as the new user Read your database from an. aspx application

Other things you could do: • Setup a CMS • Download Microsoft Web Platform

Other things you could do: • Setup a CMS • Download Microsoft Web Platform Installer • Select a CMS • Wordpress takes about 10 minutes to install

Other things you could do: • Apply for a AWS $35 student credit •

Other things you could do: • Apply for a AWS $35 student credit • Copy your MIS 324 / MIS 424 assignments to AWS Elastic Beanstalk

Say adiós to your instance • Professor Sandvig will terminate your instance. • AWS

Say adiós to your instance • Professor Sandvig will terminate your instance. • AWS charges about $0. 704 per hour for this instance type

Finished

Finished