WebApp2 Architecture
WebApp2 Architecture
Web Applications
Yingcai Xiao
Enterprise Application
Architectures
Multi-tier Applications
Multi-tier Application: an application consists of multiple
programs each may reside on a different system.
Client
Interconnection Network
Server
A Two-tier Application
(Client-Server)
Multi-tier Applications
A Three-tier Application
Client
Application Server
Interconnection Network
Database Server
Multi-tier Applications
A Four-tier Application
Client
Web Server
Internet
Application Server
Database Server
Multi-tier Applications
Client: interface to the user. It should be as thin as possible.
Thin-client: no software to install on the client site except a
standard web browser. Thin-client makes applications easy to
deploy, easy to maintain and easy to upgrade.
Web Server: communicates with the user interface.
Application Server: business logic implemented here with
tools from ASP.NET, J2EE, WebLogic (BEAS), WebSphere
(IBM). Most application servers have separate modules to
dynamically generate user interfaces to be sent to the client by the
web server.
Database Server: persistent data stored for the application.
All three server could reside in the same server hardware.
J2EE
Java 2 Enterprise Edition (http://java.sun.com/j2ee)
a platform for developing multi-tier enterprise
applications with standardized modular Java
components
provides a complete set of services to handle
many details automatically
takes advantage of many features of the Java 2
Platform, Standard Edition (J2SE)
DB Server
Thin
Client
Client
J2EE-Enabled
Web Server
User Interface
Application Logic
Database Engine
Database
DBMS / Database Server
Database API
Application Server
WEB
WEB
S
E
R
V
E
R
C
L
I
E
N
T
User Interface
Application Logic
Database Engine
Database
DBMS / Database Server
Database API
Application Server
C
L
I
E
N
T
An ASP.NET application.
The Web.config File
To support XCOPY installs to install applications by
copying them to a directory and uninstall them by
deleting the files and directories.
XML
Both the tag semantics and the tag set are user definable.
http://www.xml.com/
Web.config
Web.config is the XML file in which ASP.NET applications store
configuration data.
Case sensitive.
Web.config
Debugging
http://winserv1.cs.uakron.edu/Examples/c9/Debug/calc.aspx
Show Detailed Compiler Output
Debugging
Web.config
<configuration>
<system.web>
<customErrors mode=On
defaultRedirect=errorMessage.html />
</system.web>
</configuration>
Three custom errors modes
1. On: displays custom errorMessage.html locally and remotely
2. Off (default): displays debugging information locally and
remotely. (Dangerous!)
3. RemoteOnly: displays debugging information locally and
errorMessage.html remotely
Debugging
http://winserv1.cs.uakron.edu/Examples/c9/Debug/calc.aspx
Custom error mode On, but no defaultRedirect
Web.config
<configuration>
</configuration>
Web.config
Strings defined in the .config file can be retrieved in the program at
run time:
string conn = ConfigurationSettings.AppSettings ["MyConnectionString"];
<!-- Web.Config Configuration File -->
<configuration>
<appSettings>
<add key="MyConnectionString"
value="server=db1; database=pubs; uid=sa; pwd=" />
<add key="connectString"
value="Integrated Security=true;Initial Catalog=pubs;
Data Source=XIAO-T23-01" />
</appSettings>
</configuration>
text file
application-level
only one for each application
directives
event handlers
declarations
Global Directives:
<%@ Application Description="My First ASP.NET Application" %>
<%@ Import Namespace="System.Data" %>
<%@ Assembly Name="System.DirectoryServices" %>
System.Web.Caching.Cache
Pages: Page.Cache
Global.asax: HttpApplication.Context.Cache
Insert
Cache.Insert ("AMZN", 12.00);// or
Cache["AMZN"] = 10.00; // replace existing entry
Remove
Cache.Remove ("AMZN");
Usage
decimal amzn = (decimal) Cache["AMZN"];
Locking
System.Threading.ReaderWriterLock
rwlock.AcquireWriterLock (Timeout.Infinite);
Expiration (new)
Absolute:
Context.Cache.Insert ("Stocks", stocks, null,
DateTime.Now.AddMinutes(5),
Cache.NoSlidingExpiration();
Sliding (expires only if not accessed):
Cache.NoAbsoluteExpiration ();
Cleaning Callbacks
Context.Cache.Insert ( ,
new CacheItemRemovedCallback (RefreshDataSet));
Description
State Server
SQL Server
Add an item:
Session.Add ("10012552", "Quantity=1");
Session["10012552"] = "Quantity=1";
Retrieving an item:
string value = Session["10012552"];
Ctrl N
Start->Programs
IE
New Thread
Old Session
New Process
New Session (old IE)
Old Session (newer IE)
NS
New Thread
Old Session
New Thread
Old Session