diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000000..c2f0f84273
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,52 @@
+*.doc diff=astextplain
+*.DOC diff=astextplain
+*.docx diff=astextplain
+*.DOCX diff=astextplain
+*.dot diff=astextplain
+*.DOT diff=astextplain
+*.pdf diff=astextplain
+*.PDF diff=astextplain
+*.rtf diff=astextplain
+*.RTF diff=astextplain
+
+*.jpg binary
+*.png binary
+*.gif binary
+
+*.cs text=auto diff=csharp
+*.vb text=auto
+*.resx text=auto
+*.c text=auto
+*.cpp text=auto
+*.cxx text=auto
+*.h text=auto
+*.hxx text=auto
+*.py text=auto
+*.rb text=auto
+*.java text=auto
+*.html text=auto
+*.htm text=auto
+*.css text=auto
+*.scss text=auto
+*.sass text=auto
+*.less text=auto
+*.js text=auto
+*.lisp text=auto
+*.clj text=auto
+*.sql text=auto
+*.php text=auto
+*.lua text=auto
+*.m text=auto
+*.asm text=auto
+*.erl text=auto
+*.fs text=auto
+*.fsx text=auto
+*.hs text=auto
+
+*.csproj text=auto
+*.vbproj text=auto
+*.fsproj text=auto
+*.dbproj text=auto
+*.sln text=auto eol=crlf
+
+*.sh eol=lf
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000000..0fb89cd896
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,30 @@
+[Oo]bj/
+[Bb]in/
+TestResults/
+.nuget/
+_ReSharper.*/
+packages/
+artifacts/
+PublishProfiles/
+*.user
+*.suo
+*.cache
+*.docstates
+_ReSharper.*
+nuget.exe
+*net45.csproj
+*net451.csproj
+*k10.csproj
+*.psess
+*.vsp
+*.pidb
+*.userprefs
+*DS_Store
+*.ncrunchsolution
+*.*sdf
+*.ipch
+*.sln.ide
+project.lock.json
+.vs
+.build/
+.testPublish/
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000000..a446a333d2
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,38 @@
+language: csharp
+sudo: required
+dist: trusty
+addons:
+ apt:
+ packages:
+ - gettext
+ - libcurl4-openssl-dev
+ - libicu-dev
+ - libssl-dev
+ - libunwind8
+ - zlib1g
+env:
+ global:
+ - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
+ - DOTNET_CLI_TELEMETRY_OPTOUT: 1
+mono:
+ - 4.0.5
+os:
+ - linux
+ - osx
+osx_image: xcode7.1
+branches:
+ only:
+ - master
+ - release
+ - dev
+ - /^(.*\/)?ci-.*$/
+before_install:
+ - if test "$TRAVIS_OS_NAME" == "osx"; then brew update; brew install openssl; ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/; ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/; fi
+script:
+ - ./build.sh --quiet verify
+notifications:
+ webhooks:
+ secure: "QLltxzNQ+TUgMurX3FuWB37LVsRx6kZBTXk4JG/BELqO5/Xuwzf8ChElW29d4AbwOeYv5ONYyrvdnLtel8MJCMs8rCxZ2kZZtmUtGdUpPeMavmrvDYQeNqHhFYpLu+bEjxuilGoVI2qonI29S3Q9fC+grXsktGPwPmhyulHbwkk="
+ on_success: always
+ on_failure: always
+ on_start: always
diff --git a/AzureIntegration.sln b/AzureIntegration.sln
new file mode 100644
index 0000000000..fc19f48496
--- /dev/null
+++ b/AzureIntegration.sln
@@ -0,0 +1,51 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 14
+VisualStudioVersion = 14.0.25420.1
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.AzureAppServicesIntegration", "src\Microsoft.AspNetCore.AzureAppServicesIntegration\Microsoft.AspNetCore.AzureAppServicesIntegration.xproj", "{5916BEB5-0969-469B-976C-A392E015DFAC}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{FF9B744E-6C59-40CC-9E41-9D2EBD292435}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{33C2323B-0BCC-471B-86D0-AF872FDC7BEA}"
+EndProject
+Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.AzureAppServicesIntegration.Test", "test\Microsoft.AspNetCore.AzureAppServicesIntegration.Tests\Microsoft.AspNetCore.AzureAppServicesIntegration.Test.xproj", "{4106DB10-E09F-480E-9CE6-B39235512EE6}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2FFE2B87-BF8A-4B38-ADAB-2FE2F9BC4A7C}"
+ ProjectSection(SolutionItems) = preProject
+ global.json = global.json
+ NuGet.config = NuGet.config
+ EndProjectSection
+EndProject
+Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "AzureAppServicesSample", "sample\AzureAppServicesSample\AzureAppServicesSample.xproj", "{05A4D308-B162-4194-BC5E-88CCB4DBD318}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{37237C93-6855-40D9-9E60-418B093EF49A}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {5916BEB5-0969-469B-976C-A392E015DFAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {5916BEB5-0969-469B-976C-A392E015DFAC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {5916BEB5-0969-469B-976C-A392E015DFAC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {5916BEB5-0969-469B-976C-A392E015DFAC}.Release|Any CPU.Build.0 = Release|Any CPU
+ {4106DB10-E09F-480E-9CE6-B39235512EE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4106DB10-E09F-480E-9CE6-B39235512EE6}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4106DB10-E09F-480E-9CE6-B39235512EE6}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {4106DB10-E09F-480E-9CE6-B39235512EE6}.Release|Any CPU.Build.0 = Release|Any CPU
+ {05A4D308-B162-4194-BC5E-88CCB4DBD318}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {05A4D308-B162-4194-BC5E-88CCB4DBD318}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {05A4D308-B162-4194-BC5E-88CCB4DBD318}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {05A4D308-B162-4194-BC5E-88CCB4DBD318}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ {5916BEB5-0969-469B-976C-A392E015DFAC} = {FF9B744E-6C59-40CC-9E41-9D2EBD292435}
+ {4106DB10-E09F-480E-9CE6-B39235512EE6} = {33C2323B-0BCC-471B-86D0-AF872FDC7BEA}
+ {05A4D308-B162-4194-BC5E-88CCB4DBD318} = {37237C93-6855-40D9-9E60-418B093EF49A}
+ EndGlobalSection
+EndGlobal
diff --git a/NuGet.config b/NuGet.config
new file mode 100644
index 0000000000..826a1f9035
--- /dev/null
+++ b/NuGet.config
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/NuGetPackageVerifier.json b/NuGetPackageVerifier.json
new file mode 100644
index 0000000000..2284d32652
--- /dev/null
+++ b/NuGetPackageVerifier.json
@@ -0,0 +1,15 @@
+{
+ "adx": { // Packages written by the ADX team and that ship on NuGet.org
+ "rules": [
+ "AdxVerificationCompositeRule"
+ ],
+ "packages": {
+ "Microsoft.AspNetCore.Hosting.Azure.AppServices": { }
+ }
+ },
+ "Default": { // Rules to run for packages not listed in any other set.
+ "rules": [
+ "DefaultCompositeRule"
+ ]
+ }
+}
\ No newline at end of file
diff --git a/appveyor.yml b/appveyor.yml
new file mode 100644
index 0000000000..b9a9bcd1e6
--- /dev/null
+++ b/appveyor.yml
@@ -0,0 +1,13 @@
+init:
+ - git config --global core.autocrlf true
+branches:
+ only:
+ - master
+ - release
+ - dev
+ - /^(.*\/)?ci-.*$/
+build_script:
+ - build.cmd verify
+clone_depth: 1
+test: off
+deploy: off
\ No newline at end of file
diff --git a/build.cmd b/build.cmd
new file mode 100644
index 0000000000..7d4894cb4a
--- /dev/null
+++ b/build.cmd
@@ -0,0 +1,2 @@
+@ECHO OFF
+PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0build.ps1' %*; exit $LASTEXITCODE"
\ No newline at end of file
diff --git a/build.ps1 b/build.ps1
new file mode 100644
index 0000000000..8f2f99691a
--- /dev/null
+++ b/build.ps1
@@ -0,0 +1,67 @@
+$ErrorActionPreference = "Stop"
+
+function DownloadWithRetry([string] $url, [string] $downloadLocation, [int] $retries)
+{
+ while($true)
+ {
+ try
+ {
+ Invoke-WebRequest $url -OutFile $downloadLocation
+ break
+ }
+ catch
+ {
+ $exceptionMessage = $_.Exception.Message
+ Write-Host "Failed to download '$url': $exceptionMessage"
+ if ($retries -gt 0) {
+ $retries--
+ Write-Host "Waiting 10 seconds before retrying. Retries left: $retries"
+ Start-Sleep -Seconds 10
+
+ }
+ else
+ {
+ $exception = $_.Exception
+ throw $exception
+ }
+ }
+ }
+}
+
+cd $PSScriptRoot
+
+$repoFolder = $PSScriptRoot
+$env:REPO_FOLDER = $repoFolder
+
+$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip"
+if ($env:KOREBUILD_ZIP)
+{
+ $koreBuildZip=$env:KOREBUILD_ZIP
+}
+
+$buildFolder = ".build"
+$buildFile="$buildFolder\KoreBuild.ps1"
+
+if (!(Test-Path $buildFolder)) {
+ Write-Host "Downloading KoreBuild from $koreBuildZip"
+
+ $tempFolder=$env:TEMP + "\KoreBuild-" + [guid]::NewGuid()
+ New-Item -Path "$tempFolder" -Type directory | Out-Null
+
+ $localZipFile="$tempFolder\korebuild.zip"
+
+ DownloadWithRetry -url $koreBuildZip -downloadLocation $localZipFile -retries 6
+
+ Add-Type -AssemblyName System.IO.Compression.FileSystem
+ [System.IO.Compression.ZipFile]::ExtractToDirectory($localZipFile, $tempFolder)
+
+ New-Item -Path "$buildFolder" -Type directory | Out-Null
+ copy-item "$tempFolder\**\build\*" $buildFolder -Recurse
+
+ # Cleanup
+ if (Test-Path $tempFolder) {
+ Remove-Item -Recurse -Force $tempFolder
+ }
+}
+
+&"$buildFile" $args
\ No newline at end of file
diff --git a/build.sh b/build.sh
new file mode 100644
index 0000000000..f4208100eb
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,46 @@
+#!/usr/bin/env bash
+repoFolder="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+cd $repoFolder
+
+koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip"
+if [ ! -z $KOREBUILD_ZIP ]; then
+ koreBuildZip=$KOREBUILD_ZIP
+fi
+
+buildFolder=".build"
+buildFile="$buildFolder/KoreBuild.sh"
+
+if test ! -d $buildFolder; then
+ echo "Downloading KoreBuild from $koreBuildZip"
+
+ tempFolder="/tmp/KoreBuild-$(uuidgen)"
+ mkdir $tempFolder
+
+ localZipFile="$tempFolder/korebuild.zip"
+
+ retries=6
+ until (wget -O $localZipFile $koreBuildZip 2>/dev/null || curl -o $localZipFile --location $koreBuildZip 2>/dev/null)
+ do
+ echo "Failed to download '$koreBuildZip'"
+ if [ "$retries" -le 0 ]; then
+ exit 1
+ fi
+ retries=$((retries - 1))
+ echo "Waiting 10 seconds before retrying. Retries left: $retries"
+ sleep 10s
+ done
+
+ unzip -q -d $tempFolder $localZipFile
+
+ mkdir $buildFolder
+ cp -r $tempFolder/**/build/** $buildFolder
+
+ chmod +x $buildFile
+
+ # Cleanup
+ if test ! -d $tempFolder; then
+ rm -rf $tempFolder
+ fi
+fi
+
+$buildFile -r $repoFolder "$@"
\ No newline at end of file
diff --git a/global.json b/global.json
new file mode 100644
index 0000000000..d9b4ed63ae
--- /dev/null
+++ b/global.json
@@ -0,0 +1,3 @@
+{
+ "projects": [ "src" ]
+}
diff --git a/makefile.shade b/makefile.shade
new file mode 100644
index 0000000000..7246a0fc8f
--- /dev/null
+++ b/makefile.shade
@@ -0,0 +1,64 @@
+use import="Environment"
+
+var VERSION='0.1'
+var FULL_VERSION='0.1'
+var AUTHORS='Microsoft Open Technologies, Inc.'
+
+use-standard-lifecycle
+k-standard-goals
+
+var Configuration_Local = '${E("Configuration")}'
+default BASE_DIR_LOCAL='${Directory.GetCurrentDirectory()}'
+default TARGET_DIR_LOCAL='${Path.Combine(BASE_DIR_LOCAL, "artifacts")}'
+default BUILD_DIR_LOCAL='${Path.Combine(TARGET_DIR_LOCAL, "build")}'
+default SRC_PROJECT_GLOB_LOCAL="src/*/project.json"
+default TEST_PROJECT_GLOB_LOCAL="test/*/project.json"
+
+#build-compile target='compile' if='Directory.Exists("src")'
+ @{
+ // Don't remove the if clause in the target above - removing it will break CI test runs.
+
+ Directory.CreateDirectory(TARGET_DIR_LOCAL);
+
+ string commitHash = null;
+ if (AddAssemblyInfo)
+ {
+ var commitHashFile = Path.Combine(TARGET_DIR_LOCAL, "commit");
+ GitCommand("rev-parse HEAD >> " + commitHashFile);
+ commitHash = File.ReadAllLines(commitHashFile)[0];
+ }
+
+ var srcProjects = Files.Include(SRC_PROJECT_GLOB_LOCAL).ToList();
+ if (IsLinux)
+ {
+ srcProjects.Remove("src/Microsoft.AspNetCore.DataProtection.SystemWeb/project.json");
+ }
+ srcProjects.ForEach(projectFile =>
+ {
+ if (AddAssemblyInfo)
+ {
+ var projectText = File.ReadAllText(projectFile);
+ var project = (JsonObject)Json.Deserialize(projectText);
+ var isSharedProject = project.Keys.Contains("shared");
+
+ // We don't want to embed the commit hash in it because
+ // the consumers would get that file
+ if (!isSharedProject)
+ {
+ Console.WriteLine("Embedding commit hash in assembly");
+ var projectFolder = Path.GetDirectoryName(projectFile);
+ var commitHashAttribute = String.Format("[assembly: System.Reflection.AssemblyMetadata(\"CommitHash\", \"{0}\")]", commitHash);
+
+ var buildInfoFile = Path.Combine(projectFolder, "BuildInfo.generated.cs");
+ File.WriteAllText(buildInfoFile, commitHashAttribute);
+ }
+ }
+ DotnetPack(projectFile, BUILD_DIR_LOCAL, Configuration_Local, "");
+ });
+ DotnetBuild(TEST_PROJECT_GLOB_LOCAL, Configuration_Local, BuildFramework);
+
+ foreach (var nupkg in Files.Include(Path.Combine(BUILD_DIR_LOCAL, "*/" + Configuration_Local + "/*.nupkg")))
+ {
+ File.Copy(nupkg, Path.Combine(BUILD_DIR_LOCAL, Path.GetFileName(nupkg)), true);
+ }
+ }
\ No newline at end of file
diff --git a/sample/AzureAppServicesSample/AzureAppServicesSample.xproj b/sample/AzureAppServicesSample/AzureAppServicesSample.xproj
new file mode 100644
index 0000000000..54972a2230
--- /dev/null
+++ b/sample/AzureAppServicesSample/AzureAppServicesSample.xproj
@@ -0,0 +1,19 @@
+
+
+
+ 14.0.25420
+ $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
+
+
+
+ 05a4d308-b162-4194-bc5e-88ccb4dbd318
+ AzureAppServicesSample
+ .\obj
+ .\bin\
+
+
+
+ 2.0
+
+
+
\ No newline at end of file
diff --git a/sample/AzureAppServicesSample/Startup.cs b/sample/AzureAppServicesSample/Startup.cs
new file mode 100644
index 0000000000..779f700a2d
--- /dev/null
+++ b/sample/AzureAppServicesSample/Startup.cs
@@ -0,0 +1,87 @@
+using System;
+using System.Linq;
+using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Logging;
+
+namespace IISSample
+{
+ public class Startup
+ {
+ public void ConfigureServices(IServiceCollection services)
+ {
+ // These two middleware are registered via an IStartupFilter in UseIISIntegration but you can configure them here.
+ services.Configure(options =>
+ {
+ });
+ services.Configure(options =>
+ {
+ });
+ }
+
+ public void Configure(IApplicationBuilder app, ILoggerFactory loggerfactory)
+ {
+ loggerfactory.AddConsole(LogLevel.Debug);
+
+ var logger = loggerfactory.CreateLogger("Requests");
+
+ app.Run(async (context) =>
+ {
+ logger.LogDebug("Received request: " + context.Request.Method + " " + context.Request.Path);
+
+ context.Response.ContentType = "text/plain";
+ await context.Response.WriteAsync("Hello World - " + DateTimeOffset.Now + Environment.NewLine);
+ await context.Response.WriteAsync(Environment.NewLine);
+
+ await context.Response.WriteAsync("Address:" + Environment.NewLine);
+ await context.Response.WriteAsync("Scheme: " + context.Request.Scheme + Environment.NewLine);
+ await context.Response.WriteAsync("Host: " + context.Request.Headers["Host"] + Environment.NewLine);
+ await context.Response.WriteAsync("PathBase: " + context.Request.PathBase.Value + Environment.NewLine);
+ await context.Response.WriteAsync("Path: " + context.Request.Path.Value + Environment.NewLine);
+ await context.Response.WriteAsync("Query: " + context.Request.QueryString.Value + Environment.NewLine);
+ await context.Response.WriteAsync(Environment.NewLine);
+
+ await context.Response.WriteAsync("Connection:" + Environment.NewLine);
+ await context.Response.WriteAsync("RemoteIp: " + context.Connection.RemoteIpAddress + Environment.NewLine);
+ await context.Response.WriteAsync("RemotePort: " + context.Connection.RemotePort + Environment.NewLine);
+ await context.Response.WriteAsync("LocalIp: " + context.Connection.LocalIpAddress + Environment.NewLine);
+ await context.Response.WriteAsync("LocalPort: " + context.Connection.LocalPort + Environment.NewLine);
+ await context.Response.WriteAsync("ClientCert: " + context.Connection.ClientCertificate + Environment.NewLine);
+ await context.Response.WriteAsync(Environment.NewLine);
+
+ await context.Response.WriteAsync("User: " + context.User.Identity.Name + Environment.NewLine);
+ await context.Response.WriteAsync(Environment.NewLine);
+
+ await context.Response.WriteAsync("Headers:" + Environment.NewLine);
+ foreach (var header in context.Request.Headers)
+ {
+ await context.Response.WriteAsync(header.Key + ": " + header.Value + Environment.NewLine);
+ }
+ await context.Response.WriteAsync(Environment.NewLine);
+
+ await context.Response.WriteAsync("Environment Variables:" + Environment.NewLine);
+ var vars = Environment.GetEnvironmentVariables();
+ foreach (var key in vars.Keys.Cast().OrderBy(key => key, StringComparer.OrdinalIgnoreCase))
+ {
+ var value = vars[key];
+ await context.Response.WriteAsync(key + ": " + value + Environment.NewLine);
+ }
+ await context.Response.WriteAsync(Environment.NewLine);
+ });
+ }
+
+ public static void Main(string[] args)
+ {
+ var host = new WebHostBuilder()
+ .UseKestrel()
+ .UseAzureAppServices()
+ .UseStartup()
+ .Build();
+
+ host.Run();
+ }
+ }
+}
+
diff --git a/sample/AzureAppServicesSample/project.json b/sample/AzureAppServicesSample/project.json
new file mode 100644
index 0000000000..7d3f90c2e0
--- /dev/null
+++ b/sample/AzureAppServicesSample/project.json
@@ -0,0 +1,28 @@
+{
+ "version": "1.1.0-*",
+ "dependencies": {
+ "Microsoft.AspNetCore.AzureAppServicesIntegration": "1.0.0-*",
+ "Microsoft.AspNetCore.Server.Kestrel": "1.1.0-*",
+ "Microsoft.Extensions.Logging.Console": "1.1.0-*"
+ },
+ "buildOptions": {
+ "emitEntryPoint": true
+ },
+ "frameworks": {
+ "net451": {},
+ "netcoreapp1.0": {
+ "dependencies": {
+ "Microsoft.NETCore.App": {
+ "version": "1.0.0-*",
+ "type": "platform"
+ }
+ },
+ "imports": [ "portable-net40+sl5+win8+wp8+wpa81", "portable-net45+win8+wp8+wpa81" ]
+ }
+ },
+ "publishOptions": {
+ "include": [
+ "web.config"
+ ]
+ }
+}
\ No newline at end of file
diff --git a/src/Microsoft.AspNetCore.AzureAppServicesIntegration/AppServicesWebHostBuilderExtensions.cs b/src/Microsoft.AspNetCore.AzureAppServicesIntegration/AppServicesWebHostBuilderExtensions.cs
new file mode 100644
index 0000000000..33c4f2269d
--- /dev/null
+++ b/src/Microsoft.AspNetCore.AzureAppServicesIntegration/AppServicesWebHostBuilderExtensions.cs
@@ -0,0 +1,29 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System;
+using Microsoft.Extensions.Logging;
+
+namespace Microsoft.AspNetCore.Hosting
+{
+ public static class AppServicesWebHostBuilderExtensions
+ {
+ ///
+ /// Configures application to use Azure AppServices integration.
+ ///
+ ///
+ ///
+ public static IWebHostBuilder UseAzureAppServices(this IWebHostBuilder hostBuilder)
+ {
+ if (hostBuilder == null)
+ {
+ throw new ArgumentNullException(nameof(hostBuilder));
+ }
+
+ hostBuilder.UseIISIntegration();
+ hostBuilder.ConfigureLogging(loggerFactory => loggerFactory.AddAzureWebAppDiagnostics());
+
+ return hostBuilder;
+ }
+ }
+}
diff --git a/src/Microsoft.AspNetCore.AzureAppServicesIntegration/Microsoft.AspNetCore.AzureAppServicesIntegration.xproj b/src/Microsoft.AspNetCore.AzureAppServicesIntegration/Microsoft.AspNetCore.AzureAppServicesIntegration.xproj
new file mode 100644
index 0000000000..dc3c1475fd
--- /dev/null
+++ b/src/Microsoft.AspNetCore.AzureAppServicesIntegration/Microsoft.AspNetCore.AzureAppServicesIntegration.xproj
@@ -0,0 +1,18 @@
+
+
+
+ 14.0
+ $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
+
+
+
+ 5916beb5-0969-469b-976c-a392e015dfac
+ $(Name)
+ .\obj
+ .\bin\
+
+
+ 2.0
+
+
+
\ No newline at end of file
diff --git a/src/Microsoft.AspNetCore.AzureAppServicesIntegration/project.json b/src/Microsoft.AspNetCore.AzureAppServicesIntegration/project.json
new file mode 100644
index 0000000000..b10f437881
--- /dev/null
+++ b/src/Microsoft.AspNetCore.AzureAppServicesIntegration/project.json
@@ -0,0 +1,37 @@
+{
+ "version": "1.0.0-*",
+ "description": "ASP.NET Core integration with Azure AppServices.",
+ "packOptions": {
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/aspnet/azureintegration"
+ },
+ "tags": [
+ "aspnetcore",
+ "azure",
+ "appservices"
+ ]
+ },
+ "dependencies": {
+ "Microsoft.AspNetCore.Hosting.Abstractions": "1.1.0-*",
+ "Microsoft.AspNetCore.Server.IISIntegration": "1.1.0-*",
+ "Microsoft.Extensions.Logging.Azure.AppServicesDiagnostics": "1.0.0-*"
+ },
+ "frameworks": {
+ "net451": {
+ "frameworkAssemblies": { }
+ },
+ "netstandard1.3": {
+ "imports": [ "portable-net40+sl5+win8+wp8+wpa81", "portable-net45+win8+wp8+wpa81" ]
+ }
+ },
+ "buildOptions": {
+ "allowUnsafe": true,
+ "warningsAsErrors": true,
+ "keyFile": "../../tools/Key.snk",
+ "nowarn": [
+ "CS1591"
+ ],
+ "xmlDoc": true
+ }
+}
\ No newline at end of file
diff --git a/test/Microsoft.AspNetCore.AzureAppServicesIntegration.Tests/AppServicesWebHostBuilderExtensionsTest.cs b/test/Microsoft.AspNetCore.AzureAppServicesIntegration.Tests/AppServicesWebHostBuilderExtensionsTest.cs
new file mode 100644
index 0000000000..5c386f95f5
--- /dev/null
+++ b/test/Microsoft.AspNetCore.AzureAppServicesIntegration.Tests/AppServicesWebHostBuilderExtensionsTest.cs
@@ -0,0 +1,24 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System;
+using Microsoft.Extensions.Logging;
+using Microsoft.AspNetCore.Hosting;
+using Moq;
+using Xunit;
+
+namespace Microsoft.AspNetCore.Hosting.Azure.AppServices.Tests
+{
+ public class AppServicesWebHostBuilderExtensionsTest
+ {
+ [Fact]
+ public void UseAzureAppServices_RegisterLogger()
+ {
+ var mock = new Mock();
+
+ mock.Object.UseAzureAppServices();
+
+ mock.Verify(builder => builder.ConfigureLogging(It.IsNotNull>()), Times.Once);
+ }
+ }
+}
diff --git a/test/Microsoft.AspNetCore.AzureAppServicesIntegration.Tests/Microsoft.AspNetCore.AzureAppServicesIntegration.Test.xproj b/test/Microsoft.AspNetCore.AzureAppServicesIntegration.Tests/Microsoft.AspNetCore.AzureAppServicesIntegration.Test.xproj
new file mode 100644
index 0000000000..8b22b6e6e7
--- /dev/null
+++ b/test/Microsoft.AspNetCore.AzureAppServicesIntegration.Tests/Microsoft.AspNetCore.AzureAppServicesIntegration.Test.xproj
@@ -0,0 +1,20 @@
+
+
+
+ 14.0
+ $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
+
+
+
+ 4106db10-e09f-480e-9ce6-b39235512ee6
+ .\obj
+ .\bin\
+
+
+ 2.0
+
+
+
+
+
+
\ No newline at end of file
diff --git a/test/Microsoft.AspNetCore.AzureAppServicesIntegration.Tests/project.json b/test/Microsoft.AspNetCore.AzureAppServicesIntegration.Tests/project.json
new file mode 100644
index 0000000000..60007595bb
--- /dev/null
+++ b/test/Microsoft.AspNetCore.AzureAppServicesIntegration.Tests/project.json
@@ -0,0 +1,26 @@
+{
+ "version": "1.1.0-*",
+ "buildOptions": {
+ "keyFile": "../../tools/Key.snk"
+ },
+ "dependencies": {
+ "dotnet-test-xunit": "2.2.0-*",
+ "Microsoft.AspNetCore.AzureAppServicesIntegration": "1.0.0-*",
+ "Microsoft.AspNetCore.TestHost": "1.1.0-*",
+ "xunit": "2.2.0-*",
+ "Moq": "4.6.36-*"
+ },
+ "frameworks": {
+ "netcoreapp1.0": {
+ "dependencies": {
+ "Microsoft.NETCore.App": {
+ "version": "1.0.0-*",
+ "type": "platform"
+ }
+ },
+ "imports": [ "portable-net40+sl5+win8+wp8+wpa81", "portable-net45+win8+wp8+wpa81" ]
+ },
+ "net451": {}
+ },
+ "testRunner": "xunit"
+}
\ No newline at end of file
diff --git a/tools/Key.snk b/tools/Key.snk
new file mode 100644
index 0000000000..e10e4889c1
Binary files /dev/null and b/tools/Key.snk differ