This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Arguments. | |
param | |
( | |
[Microsoft.WindowsAzure.Management.ServiceManagement.Model.PersistentVMRoleContext]$vm = $(throw "'vm' is required."), | |
[int]$publicPort = $(throw "'publicPort' is required."), | |
[int]$dynamicPortFirst = $(throw "'dynamicPortFirst' is required."), | |
[int]$dynamicPortLast = $(throw "'dynamicPortLast' is required.") | |
) | |
Get-ChildItem "${Env:ProgramFiles(x86)}\Microsoft SDKs\Windows Azure\PowerShell\Azure\*.dll" | ForEach-Object {[Reflection.Assembly]::LoadFile($_) | out-null } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TableQuery<DictionaryTableEntity> query = | |
new TableQuery<DictionaryTableEntity>().Where(TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, "MSFT")); | |
var microsoftMetadata = customersMetadataTable.ExecuteQuery(query); | |
foreach (var record in microsoftMetadata) | |
{ | |
Console.WriteLine("Processing: {0}", record.RowKey); | |
if (record.RowKey.StartsWith("ADDRESS")) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CloudTable customersMetadataTable = tableClient.GetTableReference("customersmetadata"); | |
customersMetadataTable.CreateIfNotExists(); | |
var msftAddress1 = new DictionaryTableEntity(); | |
msftAddress1.PartitionKey = "MSFT"; | |
msftAddress1.RowKey = "ADDRESS-" + Guid.NewGuid().ToString("N").ToUpper(); | |
msftAddress1.Add("city", "Seattle"); | |
msftAddress1.Add("street", "111 South Jackson"); | |
var msftWebsite1 = new DictionaryTableEntity(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DictionaryTableEntity : TableEntity, IDictionary<string, EntityProperty> | |
{ | |
private IDictionary<string, EntityProperty> _properties; | |
public DictionaryTableEntity() | |
{ | |
_properties = new Dictionary<string, EntityProperty>(); | |
} | |
public override void ReadEntity(IDictionary<string, EntityProperty> properties, OperationContext operationContext) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Customer : TableEntity | |
{ | |
public string Name { get; set; } | |
} | |
static void CreateCustomers() | |
{ | |
// Get the customers table. | |
CloudStorageAccount storageAccount = new CloudStorageAccount(new StorageCredentials(accountName, accountKey), false); | |
CloudTableClient tableClient = storageAccount.CreateCloudTableClient(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<system.webServer> | |
<applicationInitialization remapManagedRequestsTo="Loading.htm" skipManagedModules="true" > | |
<add initializationPage="/" /> | |
</applicationInitialization> | |
</system.webServer> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Global : HttpApplication | |
{ | |
void Application_Start(object sender, EventArgs e) | |
{ | |
Thread.Sleep(10 * 1000); | |
} | |
void Application_End(object sender, EventArgs e) | |
{ | |
// Code that runs on application shutdown |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class WebRole : RoleEntryPoint | |
{ | |
public override void Run() | |
{ | |
using (var serverManager = new ServerManager()) | |
{ | |
var mainSite = serverManager.Sites[RoleEnvironment.CurrentRoleInstance.Id + "_Web"]; | |
var mainApplication = mainSite.Applications["/"]; | |
mainApplication["preloadEnabled"] = true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<ServiceDefinition name="AppInitDemo" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2012-10.1.8"> | |
<WebRole name="WebRole1" vmsize="Small"> | |
<Runtime executionContext="elevated" /> | |
... | |
</WebRole> | |
</ServiceDefinition> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Echo Installing Application Initialization | |
PKGMGR.EXE /iu:IIS-ApplicationInit |