Académique Documents
Professionnel Documents
Culture Documents
#136
Get More Refcardz! Visit refcardz.com
WebMatrix:
CONTENTS INCLUDE:
n
About WebMatrix
n
Installation
n
IIS Express
Creating Custom Sites
Advanced Web Development Made Simple
n
n
Database Integration
Hot Tips and more...
By James Sugrue
n
http://www.microsoft.com/web/webmatrix/ via Microsoft’s Site From Folder Create a site from a folder of pre-existing web files.
Web Platform Installer, which will also guide you through the
installation of dependencies such as ASP.Net Pages, SQL Server
Using the Web Gallery
When you choose to create a site from the web gallery, you will
Compact 4.0 and Microsoft.NET Framework 4.
be presented with a number of well known applications such as
Installation is as simple as clicking on Spotlight from the Web WordPress, Drupal, Joomla and many more.
Platform installer and clicking Add for the components you wish
WebMatrix guides you through the process and downloads
to install.
all dependencies required for the application such as any
required databases.
IIS EXPRESS
It has all the core capabilities of IIS 7 as well as additional features Stop Stops IIS Express.
designed to ease website development including:
Restart Stops IIS Express, releases resources and restarts IIS Express.
• It doesn’t run as a service or require administrator user Requests Displays the local requests of the site.
rights to perform most tasks.
The following table lists the tasks available to manage the site
• IIS Express works well with ASP.NET and PHP applications. settings:
• Multiple users of IIS Express can work independently on
Task Action
the same computer.
View Site Click Settings in the navigation pane.
Further information on the differences between IIS and IIS Settings
Express is available on http://learn.iis.net/page.aspx/868/iis-
Set the URL and Enter a URL and an optional port number. This setting is
express-overview/ port number preconfigured by WebMatrix and you typically do not need
to change it.
SQLSERVER COMPACT
If changing from localhost, ensure the domain is registered in
the hosts file or DNS server.
SQL Server Compact is a free, lightweight, file-based database
that can be embedded within your ASP.NET application. It Enable Select Enable SSL. This enables you to test SSL using a self-
encrypted signed certificate with IIS Express.
supports a rich subset of Transact-SQL syntax and SQL Server
connections
data types. Because it’s an in-process database, it requires no using SSL This setting is not included when you publish your site.
interprocess communication.
Set the .NET Select a version from the list (typically the latest version,
SQL Server Compact also provides a smooth migration to SQL Framework unless you want to make the site backward compatible).
Server when your application needs to handle larger amounts of version
data or high concurrent loads. The setting is included when the site is published if the
hosting provider allows it.
CREATING CUSTOM SITES To apply to a remote site click Publish and Check
Compatibility.
WebMatrix consists of a number of different workspaces, each Enable PHP Under PHP Settings, select Enable PHP. If PHP is not already
focused on particular aspects of your website. These can be support installed, WebMatrix will guide you through the installation
accessed through the Workspace Selector in the bottom left corner. process.
Site Requests
Button Description
Clear All Clears the list of all requests.
The site settings ribbon along the top of the application provides Only Errors Displays requests that results in errors.
the following functionality. Ignore Images Removes requests that get images from the list.
Capture Requests Turns request monitoring on or off.
Button Description
My Sites Lists sites that you have created. The following tasks are available from the site requests view.
Publish Publish your site. During the first time you publish you will be
prompted to configure the site publish settings.
Task Action
View Requests Click Requests in the View group in the ribbon. Select an
Run Runs the site or selected file in the browser.
individual request to see details.
Start Starts IIS Express.
Search for a specific Enter the text to find at the top of the content pane. Data Displays table data.
request
New Column Adds a column to the table.
View errors Click Only Errors on the ribbon. Select an error in the
Delete Column Deletes a column from the table.
content pane for details.
New (Relationship) Creates a new relationship between tables.
Clear existing Click Clear All in the ribbon.
requests View (Relationship) Displays existing relationships between tables.
Stop capturing Click Capture Requests in the ribbon. Delete (Relationship) Deletes a relationship between tables.
requests
New (Indexes) Creates a new index.
The following values indicate the status of requests, all of which View (Indexes) Displays existing indexes.
are standard HTTP response codes: Delete (Indexes) Deletes an index from a table.
2xx Success Delete Row Deletes a single row from the table.
You can also click on the Visual Studio button to launch the website
as a Visual Studio project in Visual Web Developer Express.
DATABASE INTEGRATION
You can migrate from SQL Server Compact to either SQL Server
Express or SQL Server. SQL Server has many useful features,
including stored procedures, handling over 256 concurrent
connections and handling databases that are larger than 4GB.
From the databases workspace, select the database that you
Table Ribbon Functions want to migrate and click on the Migrate button.
Button Description
New Table Creates a new table.
Definition Creates and modify a table schema.
Reports can be created on local or live sites through the New button.
Enter a name for the report and a URL to start analysis from.
Setting Description website. Your hosting provider may have this included in your plan.
If you are using a database other than SQL Server Compact, you Inline expression <p>The value of myMessage is: @myMessage</p>
will need to provide the connection string to your database. Adding text to code @if(condition){
<text> normal text</text>}
Check Compatibility @myMessage, @name
Expression and text
Hot The Publish menu provides a Check Compatibility option
Server Side Comment @* Comment *@
Tip where you can ensure that all the features that work
locally will work on your published site. Escape @symbol @@myMessage
@Bing.SearchBox()
Display an search box that will show results in the same window:
@Bing.AdvancedSearchBox(
boxWidth: “300px”,
resultWidth: 600,
resultHeight: 900,
themeColor: “Green”,
locale: “en-US”)
Social Networking
The Twitter helper allows you to embed Twitter feeds on your
webpage.
Display a list of tweets from your profile use :
Twitter.Profile(“username”)
@Facebook.LikeButton( @{
href: “http://refcardz.dzone.com”, WebCache.Get(“myKey”);
action: “recommend”, }
width: 250,
buttonLayout: “button_count”,
showFaces: true, Creating Your Own Helpers
colorScheme: “dark”) Hot You can also create your own Helpers for use in your
Tip websites using the @helper or @function Razor syntax.
Adding Email
The WebMail helper makes it easy to send emails from your website.
Email information is set through a number of variables.
Debugging Tips
WebMatrix provides two helpers to assist with debugging:
@{
ServerInfo and ObjectInfo.
WebMail.SmtpServer = “your-SMTP-host”;
WebMail.SmtpPort = 25; ServerInfo provides four separate views of information about the
WebMail.EnableSsl = true; server environment.
WebMail.UserName = “your-user-name-here”;
WebMail.From = “your-email-address-here”;
WebMail.Password = “your-account-password”; Type Example
} Server Configuration Information about the hosting web server, including the
version of ASP.NET.
Sending the email is done using the Send method. Note this
ASP.NET Server Details of HTTP variables, and values that are part of
should be done with a try-catch block in case of failure.
Variables each web page request.
@{ HTTP Runtime Details about the version of the .NET Framework that
WebMail.Send(to: “me@dzone.com”, Variables is running.
subject: “Email subject”,
body: bodyContent Environment Variables ll the local environment variables and their values on
}
the web server.
Caching Information ObjectInfo displays the type and value of each object that is
The WebCache helper provides caching functionality for your website. passed through to its print method:
Items are stored in the cache using a key. ObjectInfo.Print (variable)
#82
CONTENTS INCLUDE:
■
■
About Cloud Computing
Usage Scenarios Getting Started with
Aldon Cloud#64Computing
■
Underlying Concepts
Cost
by...
■
Upcoming Refcardz
youTechnologies ®
■
Data
t toTier
brough Comply.
borate.
Platform Management and more...
■
Chan
ge. Colla By Daniel Rubio
on:
dz. com
grati s
also minimizes the need to make design changes to support
CON
ABOUT CLOUD COMPUTING one time events. TEN TS
INC
s Inte -Patternvall
■
HTML LUD E:
Basics
Automated growthHTM
ref car
RichFaces
Usef
ContiPatterns an
■
However, the demands and technology used on such servers faced by web applications.Structure Tools
Core
Key ■
Structur Elem
E: has changed substantially in recent years, especially with al Elem ents
INC LUD gration the entrance of service providers like Amazon, Google and Large scale growth scenarios involvingents
specialized
NTS and mor equipment
rdz !
HTML
CO NTE Microsoft. es e... away by
(e.g. load balancers and clusters) are all but abstracted
Continu at Every e chang
About ns to isolat
relying on a cloud computing platform’s technology.
Software i-patter
space
CSS3
■
n
Re fca
e Work
Build
riptio
and Ant These companies Desc have a Privat
are in long deployed trol repos
itory
webmana applications
ge HTM
L BAS
■
Build
re
Repo
This Refcard active
will introduce are within
to you to cloud riente computing, with an
ION d units etc. Some platforms ram support large grapRDBMS deployments.
■
The src
dy Ha
softw
EGRAT e ine loping task-o it and Java s written in hical on of
all attribute
softwar emphasis onDeve es by
Mainl
INT these ines providers, so youComm can better understand
also rece JavaScri user interfac web develop and the rris
Vis it
OUS
Lucene
codel chang desc
ding e code Task Level as the
w ww.dzone.com
Spring Roo
reposit -patter particu s cies Pay only what you consume
tagge or Amazon’s cloud
the curr you cho platform
computing becisome
heavily based moron very little fine. b></ ed insid
lained ) and anti x” the are solution duce
nden For each (e.g. WAR es t
ent stan ose to writ more e imp a></ e
not lega each othe
b> is
be exp text to “fi
al Depeapplication deployment
Web ge until
nden a few years
t librari agonmen
t enviro was similar that will software
industry standard and virtualization apparen ortant, the
e HTM technology.
tterns to pro Minim packa
dard
Mo re
CI can ticular con used can rity all depe that all
targe
simp s will L t. HTM l, but r. Tags
es i-pa tend but to most phone services:
y Integ alize plans with late alloted resources,
file
ts with an and XHT lify all help or XHTML, Reg ardless L VS XH <a><
in a par hes som
etim s. Ant , they ctices,
Binar Centr temp your you prov TML b></
proces in the end bad pra enting
nt nmen
incurred cost
geme whether e a single based on
Creatsuchareresources were consumed
t enviro orthenot. Virtualization
muchallows MLaare physical othe
piece ofr hardware to be understand of HTML
approac ed with the cial, but, rily implem nden
cy Mana rties nt targe es to of the actually web cod ide a solid ing has
essa d to Depe prope into differe chang
utilized by multiple operating
function systems.simplerThis allows ing.resourcesfoundati job adm been arou
efi nec itting
associat to be ben
er
pare
Ge t
te builds commo
are not Fortuna
late Verifi e comm than on
ality be allocated nd for
n com Cloud computing asRun it’sremo
known etoday has changed this. expecte irably, that
befor
They they
etc.
(e.g. bandwidth, elem CPU) tohas
nmemory, exclusively totely
Temp
job has some time
Build
lts whe
ually,
appear effects. rm a
Privat y, contin nt team Every mov
entsinstances. ed to CSS
used
to be, HTML d. Earl
ed resu gration
The various resourcesPerfo consumed by webperio applications
dicall (e.g.
opme page system
individual operating bec Brow y exp . Whi
adverse unintend d Builds sitory Build r to devel common (HTM . ause ser HTM anded le it
ous Inte web dev manufacture L had very far mor has done
Stage Repo
e bandwidth, memory, CPU) areIntegtallied
ration on a per-unit CI serve basis L or XHT
produc Continu Refcard
e Build rm an ack from extensio .) All are
e.com
the not
DZone, Inc.
s on
expand
tutorials, cheat sheets, blogs, feature articles, source code and more.
refcardz@dzone.com
“DZone is a developer’s dream,” says PC Magazine.
Sponsorship Opportunities
Copyright © 2011 DZone, Inc. All rights reserved. No part of this publication may be reproduced, stored in a
retrieval system, or transmitted, in any form or by means electronic, mechanical, photocopying, or otherwise, sales@dzone.com Version 1.0
without prior written permission of the publisher.