-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#9 Add Lightup package and sample. Remove IISIntegration.
- Loading branch information
Showing
10 changed files
with
210 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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
19 changes: 19 additions & 0 deletions
19
sample/AzureAppServicesLightupSample/AzureAppServicesLightupSample.csproj
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
||
<Import Project="..\..\build\dependencies.props" /> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>net46;netcoreapp2.0</TargetFrameworks> | ||
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">$(PackageTargetFallback);portable-net40+sl5+win8+wp8+wpa81;portable-net45+win8+wp8+wpa81</PackageTargetFallback> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.AspNetCore" Version="$(AspNetCoreVersion)" /> | ||
<PackageReference Include="Microsoft.AspNetCore.Server.HttpSys" Version="$(AspNetCoreVersion)" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.AzureLightup\Microsoft.AspNetCore.AzureLightup.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
24 changes: 24 additions & 0 deletions
24
sample/AzureAppServicesLightupSample/Properties/launchSettings.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"iisSettings": { | ||
"windowsAuthentication": false, | ||
"anonymousAuthentication": true, | ||
"iisExpress": { | ||
"applicationUrl": "http://localhost:22071/", | ||
"sslPort": 0 | ||
} | ||
}, | ||
"profiles": { | ||
"IIS Express": { | ||
"commandName": "IISExpress", | ||
"launchBrowser": true, | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development", | ||
"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.AzureLightup;Microsoft.AspNetCore.Server.IISIntegration" | ||
} | ||
}, | ||
"AzureAppServicesSample": { | ||
"commandName": "IISExpress", | ||
"launchBrowser": true | ||
} | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
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) | ||
{ | ||
} | ||
|
||
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<string>().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() | ||
.UseStartup<Startup>() | ||
.Build(); | ||
|
||
host.Run(); | ||
} | ||
} | ||
} | ||
|
This file contains 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
24 changes: 24 additions & 0 deletions
24
sample/AzureAppServicesSample/Properties/launchSettings.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"iisSettings": { | ||
"windowsAuthentication": false, | ||
"anonymousAuthentication": true, | ||
"iisExpress": { | ||
"applicationUrl": "http://localhost:22071/", | ||
"sslPort": 0 | ||
} | ||
}, | ||
"profiles": { | ||
"IIS Express": { | ||
"commandName": "IISExpress", | ||
"launchBrowser": true, | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development", | ||
"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.Server.IISIntegration" | ||
} | ||
}, | ||
"AzureAppServicesSample": { | ||
"commandName": "IISExpress", | ||
"launchBrowser": true | ||
} | ||
} | ||
} |
This file contains 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
This file contains 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
24 changes: 24 additions & 0 deletions
24
src/Microsoft.AspNetCore.AzureLightup/AzureStartupLoader.cs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 Microsoft.AspNetCore.Hosting; | ||
|
||
[assembly: HostingStartup(typeof(Microsoft.AspNetCore.AzureLightup.AzureStartupLoader))] | ||
|
||
namespace Microsoft.AspNetCore.AzureLightup | ||
{ | ||
/// <summary> | ||
/// A dynamic azure lightup experiance | ||
/// </summary> | ||
public class AzureStartupLoader : IHostingStartup | ||
{ | ||
/// <summary> | ||
/// Calls UseAzureAppServices | ||
/// </summary> | ||
/// <param name="builder"></param> | ||
public void Configure(IWebHostBuilder builder) | ||
{ | ||
builder.UseAzureAppServices(); | ||
} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/Microsoft.AspNetCore.AzureLightup/Microsoft.AspNetCore.AzureLightup.csproj
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<Import Project="..\..\build\common.props" /> | ||
|
||
<PropertyGroup> | ||
<Description>ASP.NET Core lightup integration with Azure AppServices.</Description> | ||
<TargetFramework>netstandard1.3</TargetFramework> | ||
<GenerateDocumentationFile>true</GenerateDocumentationFile> | ||
<PackageTags>aspnetcore;azure;appservices</PackageTags> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="$(AspNetCoreVersion)" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Microsoft.AspNetCore.AzureAppServicesIntegration\Microsoft.AspNetCore.AzureAppServicesIntegration.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |