Beruflich Dokumente
Kultur Dokumente
When you deploy your application to Azure Websites, you can deploy to a separate
deployment slot instead of the default production slot, which are actually live sites
with their own hostnames.
This option is available in the Standard web hosting plan.
Benefits
After a swap, the slot with previously staged site now has the previous production
site. If the changes swapped into the production slot are not as you expected, you can
perform the same swap immediately to get your "last known good site" back.
Deploying a site to a slot first and swapping it into production ensures that all
instances of the slot are warmed up before being swapped into production. This
eliminates downtime when you deploy your site. The traffic redirection is seamless,
and no requests are dropped as a result of swap operations.
Multiple deployment slots are only available for sites in the Standard web
hosting plan. When your website has multiple slots, you cannot change the web hosting
plan.
Scaling is not available and Linked resource management is not supported for
non-production slots.
By default, your deployment slots (sites) share the same resources as your
production slots (sites) and run on the same VMs. If you run stress testing on a stage
slot, your production environment will experience a comparable stress load.
Handler mappings
Publishing endpoints
Scale settings
New-AzureWebsite
New-AzureWebsite siteslotstest -Slot staging -Location "West US"
Publish-AzureWebsiteProject
Publish-AzureWebsiteProject -Name siteslotstest -Slot staging -Package [path].zip
Show-AzureWebsite
Show-AzureWebsite -Name siteslotstest -Slot staging
Switch-AzureWebsiteSlot
Switch-AzureWebsiteSlot -Name siteslotstest
Remove-AzureWebsite
Remove-AzureWebsite -Name siteslotstest -Slot staging
Changing the name of a role. Remove and then add the role with the new name.
Any role instances which had not yet been updated or upgraded to the new version
are not updated or upgraded, because those instances are already running the target
version of the service.
Any role instances which had already been updated or upgraded to the new version
of the service package (*.cspkg) file or the service configuration (*.cscfg) file (or both files)
are reverted to the pre-upgrade version of these files.
This functionally is provided by the following features:
The Locked element and the RollbackAllowed element, which are returned as part of
the response body of the Get Deployment and Get Cloud Service Properties operations:
1.
The Locked element allows you to detect when a mutating operation can be
invoked on a given deployment.
2.
The RollbackAllowed element allows you to detect when the Rollback Update
Or Upgrade operation can be called on a given deployment.
In order to perform a rollback, you do not have to check both the Locked and
the RollbackAllowed elements. It suffices to confirm that RollbackAllowed is set to true.
These elements are only returned if these methods are invoked by using the request header
set to x-ms-version: 2011-10-01 or a later version. For more information about versioning
headers, see Service Management Versioning.
There are some situations where a rollback of an update or upgrade is not supported, these
are as follows:
Reduction in local resources - If the update increases the local resources for a role the
Azure platform does not allow rolling back. For more information about how to configure
local resources for a role, see Configure Local Storage Resources.
Quota limitations - If the update was a scale down operation you may no longer have
sufficient compute quota to complete the rollback operation. Each Windows Azure
subscription has a quota associated with it that specifies the maximum number of cores
which can be consumed by all hosted services that belong to that subscription. If performing
a rollback of a given update would put your subscription over quota then that a rollback will
not be enabled.
Race condition - If the initial update has completed, a rollback is not possible.
hosting plan gets its own set of virtual machines. Since you can move websites between
web hosting plans, assuming the web hosting plans are in the same regions, the
decision of whether to create a new web hosting plan or not is of less important. If a
given website starts consuming too many resources or you just need to separate a few
websites, you can create a new web hosting plan and move your websites to it.
If you want to create a new website in a different region, and that region doesn't have
an existing web hosting plan, you will have to create a new web hosting plan in that
region
to
be
able
to
have
a
website
associated
with
it.
An important thing to keep in mind is that you cannot move web hosting plans or
websites between resource groups. Also, you cannot move a website between two web
hosting plans that are in two separate regions.
How
do
create
Web
Hosting
Plan?
Answer: A Web Hosting Plan is a container and as such, you can't create an empty Web
Hosting Plan. However, a new Web Hosting Plan is explicitly created during site
creation.
To do this
using
the
UI
in
the
new Azure
Portal
select Website, which will open the Website creation blade. In the first image below
you can see the NEW icon on the bottom left, and in the second image you can see
the Website creation blade, the Web Hosting Plan blade and thePricing Tier blade:
t should also be noted that a Web Hosting Plan can also be created in the existing Azure
Portal. This is done as part of the quick create wizard by selectingCreate new web
hosting plan from the WEB HOSTING PLAN drop down:
Question:
How
do
assign
site
to
a Web
Hosting
Plan?
Answer: Sites are assigned to a Web Hosting Plan as part of the site creation process.
To do this using the UI in the new Azure Portal Preview, click NEWand
select Website
leverage
all
the
features
and
resources
of
the
Standard
tier.
Question:
How
can
I
Scale
a
Web
Hosting
Plan?
Answer: There are two ways to scale a Web Hosting Plan. One way is to scale up your
web hosting plan and all sites associated with that web hosting plan. By changing the
pricing tier of a web hosting plan, all sites in that web hosting plan will be subject to the
features and resources defined by that pricing tier.
The second way to scale a plan is to scale it out by increasing the number of instances
in your Web Hosting Plan.
Question:
How
Can
I
Delete
a
Web
Hosting
Plan?
Answer: To delete a Web Hosting Plan you must first delete all websites associated with
it. Once all the Websites in a Web Hosting Plan have been deleted a Web Hosting Plan
can be deleted from the Web Hosting Plan blade:
In the Full Azure Portal deleting the last website in a web hosting plan will automatically
delete
the
associated
web
hosting
plan.
Question:
How
Can
I
monitor
a
web
hosting
plan?
Answer: Web Hosting Plans can be monitored using the Monitoring parts in the Web
Hosting Plan Blade:
migrate websites between hosting plans
Configure websites
define and use app settings, connection strings, handlers, and virtual directories
Windows Azure Web Sites: How Application Strings and Connection Strings Work
Windows Azure Web Sites has a handy capability whereby developers can store keyvalue string pairs in Azure as part of the configuration information associated with a
website. At runtime, Windows Azure Web Sites automatically retrieves these values for
you and makes them available to code running in your website.
since sensitive information such as Sql connection strings with passwords never show
up as cleartext in a web.config or php.ini file.
Difference between appsetting and connectionstring includes a little extra metadata
telling Windows Azure Web Sites that the string value is a database connection string.
Here is what the example page output looks from the previous code snippet:
Developers can easily retrieve these values from any of the web application frameworks
supported in Windows Azure Web Sites.
From the previous examples you will have noticed a naming pattern for referencing the
individual keys. For app settings the name of the corresponding environment variable
is prepended with APPSETTING_.
For connection strings, there is a naming convention used to prepend the
environment variable depending on the type of database you selected in the databases
dropdown. The sample code is using SQLAZURECONNSTR_ since the connection
string that was configured had Sql Databases selected in the dropdown.
The full list of database connection string types and the prepended string used for
naming environment variables is shown below:
If you select Sql Databases, the prepended string is SQLAZURECONNSTR_
If you select SQL Server the prepended string is SQLCONNSTR_
If you select MySQL the prepended string is MYSQLCONNSTR_
If you select Custom the prepended string is CUSTOMCONNSTR_
Connection string
Note that for the property $cs.Type, you can use any of the following strings to define
the type: Custom, SQLAzure, SQLServer, and MySql.
There are two types of storage account containers in Windows Azure private
and public. A resource in a private container can only be viewed by specifying
an access key along with the request. A public container on the other hand is
viewable by anyone. When creating a new storage account in Windows Azure,
new containers are private by default. Therefore when you attempt to access a
resources URL in the browser, you will get an HTTP 404
Making containser public
1.
CloudStorageAccount cloudStorageAccount
= CloudStorageAccount.FromConfigurationSetting(DataConnectionString);
2.
CloudBlobClient cloudBlobClient =
cloudStorageAccount.CreateCloudBlobClient();
3.
CloudBlobContainer cloudBlobContainer =
cloudBlobClient.GetContainerReference(nolabel);
4.
cloudBlobContainer.CreateIfNotExist();
5.
cloudBlobContainer.SetPermissions(
6.
7.
);
use an HTTP handler to intercept jpeg requests so that I can call one of the
aforementioned methods and write the jpeg to the response stream which will
display the image.
1. public class JpegHandler1 : IHttpHandler
2.
3.
4.
5.
6.
7.
if (string.IsNullOrEmpty(imageUri) == false)
8.
9.
CloudStorageAccount cloudStorageAccount =
CloudStorageAccount.FromConfigurationSetting(DataConnectionString);
10.
CloudBlobClient cloudBlobClient =
cloudStorageAccount.CreateCloudBlobClient();
11.
12.
13.
14.
if (cloudBlobBytes != null)
15.
16.
context.Response.Clear();
17.
context.Response.ContentType = image/jpeg;
18.
context.Response.BinaryWrite(cloudBlobBytes);
19.
context.Response.End();
20.
21.
22.
23.
24.
25.
26.
get
27.
28.
return false;
29.
30.
31.
}
}
<system.webServer>
2.
<modulesrunAllManagedModulesForAllRequests=true />
3.
<handlers>
4.
<addname=JpegHandlerverb=*path=*.jpgtype=JpegHandlerresourceTyp
e=Unspecified/>
5.
</handlers>
6.
</system.webServer>
SiteName: Kaushal
HostName: kaushal.azurewebsites.net
Create a virtual directory within my site called BLOG via azure portal and link a MySQL
database to this site.
On my Local Machine, download and install WordPress via WebMatrix and deploy it to the
virtual directory we created above.
NOTE:
In order to enable HTTPS for custom domain names, you must configure your
website for Standard web hosting plan mode. This may incur additional costs if you
are currently using free or shared mode.
The certificate must meet the following requirements for SSL certificates in Azure:
The certificate's subject name must match the domain used to access the
website. If you need to serve multiple domains with this certificate, you will need to
use a wildcard value or specify subjectAltName values as discussed previously.
<rewrite>
<rules>
<rule name="Force HTTPS" enabled="true">
<match url="(.*)" ignoreCase="false" />
<conditions>
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true"
redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
NOTE:
If your application is written in Node.js, PHP, Python Django, or Java, it probably
doesn't include a web.config file. However Node.js,Python Django, and Java all
actually do use a web.config when hosted on Azure Websites - Azure creates the file
automatically during deployment, so you never see it. If you include one as part of your
application, it will override the one that Azure automatically generates.
NOTE:
.NET MVC applications should use the RequireHttps filter instead of URL Rewrite.
Elliptic Curve Cryptography (ECC) certificates are supported with Azure Websites
Go to the CONFIGURE page for the site and scroll to the virtual applications and directories
section at the bottom of the page.
Add an entry
Click on SAVE.
Now go to the LINKED RESOURCES page and link a MySQL database to your site.
NOTE: Choose an existing MySQL DB or create a new one. Let's say you already
have a free MySQL DB associated with your subscription but you want a
separate MySQL database for the application. You will have to purchase a plan
from CLEARDB for this
Under quick glance section a hyperlink called View connection strings will be created.
NOTE: You could retrieve the connection string parameters from the LINKED RESOURCES
page too. Click on MANAGE in the bottom pane for the site. This will redirect you to ClearDB
site which will provide you with the following
Database
Data Source
User Id
Password
Download & save the publishsettings file for the website by clicking the hyperlink "Download
the publish profile" under quick glance section of theDASHBOARD page.
Local Machine
Once done it will start downloading the contents to your local machine
(C:\Users\<username>\Documents\My Web Sites\WordPress)
During these process it allows you to configure certain application parameters as shown below:
Once you specify the parameters and click on Next it proceeds with the installation.
Once installed, click on "Copy user names and passwords". This will copy the details to
clipboard which you could save in a text file.
Click on OK.
Click on Import publish profile and point it to the location where we saved the
publishsettings file we downloaded earlier.
Once selected, it will auto-populate the parameters from the publishsettings file.
Site name: kaushal\wordpress (physical path location relative to the root site)
NOTE: Don't chose FTP as the protocol as it doesn't allow you to publish databases.
Click on Validate Connection. Once validated, you will see the confirmation.
Click on Save.
This will take you to the Publish Compatibility page. Click on Continue.
It will display the list of files that will deployed to the server.
Once publishing is completed you could open the log file and analyze.
NOTE:
The IP address may change if you delete and recreate your website, or change
the website mode back to free.
If the A record maps the root domain or a wildcard domain: Create a CNAME
record that maps
from awverify.<yourdomain> to awverify.<yourwebsitename>.azurewebsites.n
et. For example, if the A record is for contoso.com, create a CNAME record
for awverify.contoso.com.
If the A record maps a specific subdomain: Create a CNAME record that maps
from awverify.<subdomain> to awverify.<yourwebsitename>.azurewebsites.ne
t. For example, if the A record is for blogs.contoso.com, create a CNAME record
for awverify.blogs.contoso.com.
Visitors to your site will not see the awverify subdomain; its only for Azure to verify your
domain.
NOTE:
It can take some time for CNAME records created in the previous steps to propagate
through the DNS system. You cannot add the domain name of to your Azure Website
until the CNAME has propagated. If you are using an A record, you cannot add the A
record domain name to your Azure Website until the awverify CNAME record created in
the previous step has propagated.
Application Diagnostics
The application diagnostics section of the Configure management page controls the
logging of information produced by the application, which is useful when logging events
that occur within an application. For example, when an error occurs in your application,
you may wish to present the user with a friendly error while writing more detailed error
information to the log for later analysis.
You can enable or disable the following application diagnostics:
Information level information is logged. You may also select Verbose, which will log all
information produced by the application.
Logs produced by this setting are stored on the file system of your website, and can be
downloaded using the steps in the Downloading log files for a website section
below.
Site Diagnostics
The site diagnostics section of the Configure management page controls the logging
performed by the web server, such as the logging of web requests, failure to serve
pages, or how long it took to serve a page. You can enable or disable the following
options:
Web Server Logging - Turn on Web Server logging to save website logs using
the W3C extended log file format. Web server logging produces a record of all incoming
requests to your website, which contains information such as the client IP address,
requested URI, HTTP status code of the response, and the user agent string of the client.
You can save the logs to an Azure Storage Account or to the File System.
To save web server logs to an Azure Storage Account, choose Storage, and then
choose manage storage to specify a storage account and an Azure Blob Container
where the logs will be kept. For more information about Azure Storage Accounts,
see How to Manage Storage Accounts.
To save web server logs to the file system, choose File System. This enables
the Quota box where you can set the maximum amount of disk space for the log files.
The minimum size is 25MB and the maximum is 100MB. The default size is
Advanced configuration
Diagnostics can be further modified by adding key/value pairs to the app
settings section of the Configure management page. The following settings can be
configured from app settings:
DIAGNOSTICS_TEXTTRACELOGDIRECTORY
The location in which application logs will be saved, relative to the web root.
The maximum buffer size to use when capturing application logs. Information is
initially written to the buffer before being flushed to file or storage. If new information is
written to the buffer before it can be flushed, you may lose previously logged
information. If your application produces large bursts of log information, consider
increasing the size of the buffer.
35MB.
By default, web server logs are never deleted. To specify a period of time after which
the logs will be automatically deleted, select Set Retention and enter the number of
days to keep the logs in the Retention Period box. This setting is available for both the
Azure Storage and File System options.
Read Files with: A text editor or parser that understands the values produced by
your application
Log File Type: Failed Request Tracing
the XML file(s) because the XSL file provides functionality for formatting and filtering the
contents of the XML file(s) when viewed in Internet Explorer.
Things you can try: Lists possible solutions for resolving the problem reported
by the error.
Read Files with: Log Parser. Used to parse and query IIS log files. Log Parser 2.2 is
available on the Microsoft Download Center athttp://go.microsoft.com/fwlink/?
LinkId=246619.
Site diagnostics
Site diagnostics allow to you enable or disable the following:
Detailed Error Logging - Logs detailed error information for HTTP status codes
that indicate a failure (status code 400 or greater). This may contain information that
can help determine why the server returned the error code.
component. This can be useful if you are attempting to increase site performance or
isolate what is causing a specific HTTP error to be returned.
Web Server Logging - Logs all HTTP transactions on a website using the W3C
extended log file format. This report is useful when determining overall site metrics such
as the number of requests handled or how many requests are from a specific IP address
Site diagnostics
Site diagnostics allow to you enable or disable the following:
Detailed Error Logging - Logs detailed error information for HTTP status codes
that indicate a failure (status code 400 or greater). This may contain information that
can help determine why the server returned the error code.
Web Server Logging - Logs all HTTP transactions on a website using the W3C
extended log file format. This report is useful when determining overall site metrics such
as the number of requests handled or how many requests are from a specific IP address
Application diagnostics
Application diagnostics allows you to capture information produced by a web
application. ASP.NET applications can use the System.Diagnostics.Trace class to log
information to the application diagnostics log. For example:
File system - stores the application diagnostics information to the website file
system. These files can be accessed by FTP, or downloaded as a Zip archive by using
the Azure PowerShell or Azure Command-Line Tools.
Retention period - by default, logs are not automatically deleted from blob
storage. Select set retention and enter the number of days to keep logs if you wish to
automatically delete logs.
Diagnostics can also be enabled from Azure PowerShell using the SetAzureWebsite cmdlet.
Web Server Logs - /LogFiles/http/RawLogs. This folder contains one or more text
files formatted using the W3C extended log file format.
Logging to the file system provides the most basic information of the three available
methods, providing only the time, process id, event level, and message.
Table storage
When logging to table storage, additional properties are used to facilitate searching the
data stored in the table as well as more granular information on the event. The following
properties (columns) are used for each entity (row) stored in the table.
PROPERTY NAME
VALUE/FORMAT
PARTITIONKEY
RowKey
Timestamp
EventTickCount
ApplicationName
Level
EventId
InstanceId
Pid
Process ID
PROPERTY NAME
VALUE/FORMAT
PARTITIONKEY
Tid
Message
Blob storage
When logging to blob storage, data is stored in comma-separated values (CSV) format.
Similar to table storage, additional fields are logged to provide more granular
information about the event. The following properties are used for each row in the CSV:
PROPERTY NAME
VALUE/FORMAT
Date
Level
ApplicationName
InstanceId
EventTickCount
EventId
Pid
Process ID
Tid
PROPERTY NAME
VALUE/FORMAT
Message
date,level,applicationName,instanceId,eventTickCount,eventId,pid,tid,message
2014-01-30T16:36:52,Error,mywebsite,6ee38a,635266966128818593,0,3096,9,An error occurred
NOTE:
The first line of the log will contain the column headers as represented in this example.
Route visitors to your site to a region that will provide the best performance.
Automatically route traffic to a secondary region if there is a problem in the primary region
where your site is hosted.
Spread load evenly across multiple copies of your website hosted in multiple regions.
In order to use ATM with Web Sites, you will need to have two or more sites and each of them must be
running in a different region. You can only add one website per region to ATM, so this requirement is
important.
You must run your sites in Standard mode or Basic mode in order to use ATM with Web Sites.
ATM will route traffic based on a profile that you create.
Once youve created your ATM profile, youll want to add your endpoints.
ATM will use the path in the Monitoring Settings section to check the endpoints you configured. It
performs that check once every 30 seconds, and only an HTTP 200 status is considered healthy.
Therefore, if your application is designed in a way that causes a non-200 response to the root of the
site (e.g. an ASP.NET forms authentication site that might return a 302 redirect to the login page),
youll want to configure a path and file name for your ATM profile that points to an unprotected file so
that a 200 response is returned.
Web Sites knows how to route the ATM URL to your site because it adds your ATM URL to the custom
domains for your site automatically ie when you add endpoint in your ATM profile.
To use custom domain name first need to create a www CNAME entry at your domain registrar that
points to your ATM URL
Note: Your subdomain may not be www. In that case, create a CNAME record for the subdomain you
want to use.
Note: ATM is CNAME based and doesnt support A records. Therefore, you cant use a naked domain
(mydomain.com) with ATM. It requires that you set up a CNAME record.
Performance When this method is used, ATM will send users to the region where he or she
will get the best performance. This prevents situations where, for example, a user who is in the
Central US region is directed to a site running in West Europe.
Failover This method will redirect traffic to a secondary region if there is a problem in the
primary region. For example, you may have a site in a backup region that doesnt handle any
traffic unless your primary site is offline for some reason.
Round Robin This method will evenly distribute traffic across the endpoints configured in
your ATM profile using a round robin load balancing methodology. You can use this method, for
example, to ramp up traffic to a particular endpoint without allowing it to receive all of your
traffic immediately. (In the future, ATM will include enhanced functionality to make this kind of
scenario even easier to configure.)