Skip to content

Commit

Permalink
#9 Add Lightup package and sample. Remove IISIntegration.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tratcher committed Mar 30, 2017
1 parent 023f612 commit c3a01be
Show file tree
Hide file tree
Showing 10 changed files with 210 additions and 9 deletions.
22 changes: 18 additions & 4 deletions AzureIntegration.sln
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26208.0
VisualStudioVersion = 15.0.26323.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.AzureAppServicesIntegration", "src\Microsoft.AspNetCore.AzureAppServicesIntegration\Microsoft.AspNetCore.AzureAppServicesIntegration.csproj", "{5916BEB5-0969-469B-976C-A392E015DFAC}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.AzureAppServicesIntegration", "src\Microsoft.AspNetCore.AzureAppServicesIntegration\Microsoft.AspNetCore.AzureAppServicesIntegration.csproj", "{5916BEB5-0969-469B-976C-A392E015DFAC}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{FF9B744E-6C59-40CC-9E41-9D2EBD292435}"
EndProject
Expand All @@ -11,13 +11,17 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
NuGet.config = NuGet.config
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AzureAppServicesSample", "sample\AzureAppServicesSample\AzureAppServicesSample.csproj", "{05A4D308-B162-4194-BC5E-88CCB4DBD318}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AzureAppServicesSample", "sample\AzureAppServicesSample\AzureAppServicesSample.csproj", "{05A4D308-B162-4194-BC5E-88CCB4DBD318}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{37237C93-6855-40D9-9E60-418B093EF49A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{CD650B4B-81C2-4A44-AEF2-A251A877C1F0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.AzureAppServicesIntegration.Tests", "test\Microsoft.AspNetCore.AzureAppServicesIntegration.Tests\Microsoft.AspNetCore.AzureAppServicesIntegration.Tests.csproj", "{9BA1B692-B313-4E22-A864-F0ADBBE3C3FA}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.AzureAppServicesIntegration.Tests", "test\Microsoft.AspNetCore.AzureAppServicesIntegration.Tests\Microsoft.AspNetCore.AzureAppServicesIntegration.Tests.csproj", "{9BA1B692-B313-4E22-A864-F0ADBBE3C3FA}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.AzureLightup", "src\Microsoft.AspNetCore.AzureLightup\Microsoft.AspNetCore.AzureLightup.csproj", "{AC023B45-7995-4D4A-8108-E512AE8E5734}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AzureAppServicesLightupSample", "sample\AzureAppServicesLightupSample\AzureAppServicesLightupSample.csproj", "{939EA897-CA31-4F2E-BA51-22B570B64671}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -37,6 +41,14 @@ Global
{9BA1B692-B313-4E22-A864-F0ADBBE3C3FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9BA1B692-B313-4E22-A864-F0ADBBE3C3FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9BA1B692-B313-4E22-A864-F0ADBBE3C3FA}.Release|Any CPU.Build.0 = Release|Any CPU
{AC023B45-7995-4D4A-8108-E512AE8E5734}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AC023B45-7995-4D4A-8108-E512AE8E5734}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AC023B45-7995-4D4A-8108-E512AE8E5734}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AC023B45-7995-4D4A-8108-E512AE8E5734}.Release|Any CPU.Build.0 = Release|Any CPU
{939EA897-CA31-4F2E-BA51-22B570B64671}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{939EA897-CA31-4F2E-BA51-22B570B64671}.Debug|Any CPU.Build.0 = Debug|Any CPU
{939EA897-CA31-4F2E-BA51-22B570B64671}.Release|Any CPU.ActiveCfg = Release|Any CPU
{939EA897-CA31-4F2E-BA51-22B570B64671}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -45,5 +57,7 @@ Global
{5916BEB5-0969-469B-976C-A392E015DFAC} = {FF9B744E-6C59-40CC-9E41-9D2EBD292435}
{05A4D308-B162-4194-BC5E-88CCB4DBD318} = {37237C93-6855-40D9-9E60-418B093EF49A}
{9BA1B692-B313-4E22-A864-F0ADBBE3C3FA} = {CD650B4B-81C2-4A44-AEF2-A251A877C1F0}
{AC023B45-7995-4D4A-8108-E512AE8E5734} = {FF9B744E-6C59-40CC-9E41-9D2EBD292435}
{939EA897-CA31-4F2E-BA51-22B570B64671} = {37237C93-6855-40D9-9E60-418B093EF49A}
EndGlobalSection
EndGlobal
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>
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
}
}
}
79 changes: 79 additions & 0 deletions sample/AzureAppServicesLightupSample/Startup.cs
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();
}
}
}

5 changes: 2 additions & 3 deletions sample/AzureAppServicesSample/AzureAppServicesSample.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<Import Project="..\..\build\dependencies.props" />

Expand All @@ -12,8 +12,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.AspNetCore" Version="$(AspNetCoreVersion)" />
</ItemGroup>

</Project>
24 changes: 24 additions & 0 deletions sample/AzureAppServicesSample/Properties/launchSettings.json
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
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public static IWebHostBuilder UseAzureAppServices(this IWebHostBuilder hostBuild
throw new ArgumentNullException(nameof(hostBuilder));
}

hostBuilder.UseIISIntegration();
hostBuilder.ConfigureLogging(loggerFactory => loggerFactory.AddAzureWebAppDiagnostics());

return hostBuilder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="$(AspNetCoreVersion)" />
</ItemGroup>

Expand Down
24 changes: 24 additions & 0 deletions src/Microsoft.AspNetCore.AzureLightup/AzureStartupLoader.cs
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();
}
}
}
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>

0 comments on commit c3a01be

Please sign in to comment.