Merge remote-tracking branch 'AzureIntegration/rybrande/release21ToSrc' into rybrande/Mondo2.1
This commit is contained in:
commit
c9e0295d1d
|
|
@ -0,0 +1,34 @@
|
||||||
|
[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/
|
||||||
|
global.json
|
||||||
|
msbuild.binlog
|
||||||
|
.test-dotnet/
|
||||||
|
.deps/
|
||||||
|
|
@ -0,0 +1,152 @@
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio 15
|
||||||
|
VisualStudioVersion = 15.0.27016.1
|
||||||
|
MinimumVisualStudioVersion = 15.0.26730.03
|
||||||
|
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}"
|
||||||
|
ProjectSection(SolutionItems) = preProject
|
||||||
|
src\Directory.Build.props = src\Directory.Build.props
|
||||||
|
EndProjectSection
|
||||||
|
EndProject
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2FFE2B87-BF8A-4B38-ADAB-2FE2F9BC4A7C}"
|
||||||
|
ProjectSection(SolutionItems) = preProject
|
||||||
|
build\dependencies.props = build\dependencies.props
|
||||||
|
Directory.Build.props = Directory.Build.props
|
||||||
|
Directory.Build.targets = Directory.Build.targets
|
||||||
|
NuGet.config = NuGet.config
|
||||||
|
EndProjectSection
|
||||||
|
EndProject
|
||||||
|
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}"
|
||||||
|
ProjectSection(SolutionItems) = preProject
|
||||||
|
test\Directory.Build.props = test\Directory.Build.props
|
||||||
|
EndProjectSection
|
||||||
|
EndProject
|
||||||
|
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.AzureAppServices.HostingStartup", "src\Microsoft.AspNetCore.AzureAppServices.HostingStartup\Microsoft.AspNetCore.AzureAppServices.HostingStartup.csproj", "{AC023B45-7995-4D4A-8108-E512AE8E5734}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AzureAppServicesHostingStartupSample", "sample\AzureAppServicesHostingStartupSample\AzureAppServicesHostingStartupSample.csproj", "{939EA897-CA31-4F2E-BA51-22B570B64671}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.ApplicationInsights.HostingStartup", "src\Microsoft.AspNetCore.ApplicationInsights.HostingStartup\Microsoft.AspNetCore.ApplicationInsights.HostingStartup.csproj", "{2849A2D9-7C08-4198-BF2B-8BFB4B13554D}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationInsightsHostingStartupSample", "sample\ApplicationInsightsHostingStartupSample\ApplicationInsightsHostingStartupSample.csproj", "{33E245F0-2566-4B5B-BA7C-8895B7A697AE}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Web.Xdt.Extensions", "src\Microsoft.Web.Xdt.Extensions\Microsoft.Web.Xdt.Extensions.csproj", "{9B22E525-FEC9-4C7C-9F9C-598C15BD0250}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.AzureAppServices.SiteExtension", "extensions\Microsoft.AspNetCore.AzureAppServices.SiteExtension\Microsoft.AspNetCore.AzureAppServices.SiteExtension.csproj", "{1CE2D76B-39E6-46C0-8F6F-C63E370955A9}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationInsights.HostingStartup.Tests", "test\ApplicationInsights.HostingStartup.Tests\ApplicationInsights.HostingStartup.Tests.csproj", "{0899A101-E451-40A4-81B0-7AA18202C25D}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.AzureAppServices.FunctionalTests", "test\Microsoft.AspNetCore.AzureAppServices.FunctionalTests\Microsoft.AspNetCore.AzureAppServices.FunctionalTests.csproj", "{2B2C37FF-9249-4EA4-9A7F-038B55A15C2C}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Web.Xdt.Extensions.Tests", "test\Microsoft.Web.Xdt.Extensions.Tests\Microsoft.Web.Xdt.Extensions.Tests.csproj", "{809AEE05-1B28-4E31-8959-776B249BD725}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.AzureAppServices.SiteExtension.Tests", "test\Microsoft.AspNetCore.AzureAppServices.SiteExtension.Tests\Microsoft.AspNetCore.AzureAppServices.SiteExtension.Tests.csproj", "{491A857A-3529-4375-985D-D748F9F01476}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.ApplicationModelDetection", "src\Microsoft.Extensions.ApplicationModelDetection\Microsoft.Extensions.ApplicationModelDetection.csproj", "{F0CABFE8-A5B1-487B-A451-A486D26742D3}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.ApplicationModelDetection.Tests", "test\Microsoft.Extensions.ApplicationModelDetection.Tests\Microsoft.Extensions.ApplicationModelDetection.Tests.csproj", "{15664836-2B94-4D2D-AC18-6DED01FCCCBD}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Runtime.SiteExtension", "extensions\Microsoft.AspNetCore.Runtime.SiteExtension\Microsoft.AspNetCore.Runtime.SiteExtension.csproj", "{E1E9BC7A-6951-4B60-8DFB-DBB9AC3CDEB0}"
|
||||||
|
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
|
||||||
|
{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
|
||||||
|
{9BA1B692-B313-4E22-A864-F0ADBBE3C3FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{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
|
||||||
|
{2849A2D9-7C08-4198-BF2B-8BFB4B13554D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{2849A2D9-7C08-4198-BF2B-8BFB4B13554D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{2849A2D9-7C08-4198-BF2B-8BFB4B13554D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{2849A2D9-7C08-4198-BF2B-8BFB4B13554D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{33E245F0-2566-4B5B-BA7C-8895B7A697AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{33E245F0-2566-4B5B-BA7C-8895B7A697AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{33E245F0-2566-4B5B-BA7C-8895B7A697AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{33E245F0-2566-4B5B-BA7C-8895B7A697AE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{9B22E525-FEC9-4C7C-9F9C-598C15BD0250}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{9B22E525-FEC9-4C7C-9F9C-598C15BD0250}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{9B22E525-FEC9-4C7C-9F9C-598C15BD0250}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{9B22E525-FEC9-4C7C-9F9C-598C15BD0250}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{1CE2D76B-39E6-46C0-8F6F-C63E370955A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{1CE2D76B-39E6-46C0-8F6F-C63E370955A9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{1CE2D76B-39E6-46C0-8F6F-C63E370955A9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{1CE2D76B-39E6-46C0-8F6F-C63E370955A9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{0899A101-E451-40A4-81B0-7AA18202C25D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{0899A101-E451-40A4-81B0-7AA18202C25D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{0899A101-E451-40A4-81B0-7AA18202C25D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{0899A101-E451-40A4-81B0-7AA18202C25D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{2B2C37FF-9249-4EA4-9A7F-038B55A15C2C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{2B2C37FF-9249-4EA4-9A7F-038B55A15C2C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{2B2C37FF-9249-4EA4-9A7F-038B55A15C2C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{2B2C37FF-9249-4EA4-9A7F-038B55A15C2C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{809AEE05-1B28-4E31-8959-776B249BD725}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{809AEE05-1B28-4E31-8959-776B249BD725}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{809AEE05-1B28-4E31-8959-776B249BD725}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{809AEE05-1B28-4E31-8959-776B249BD725}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{491A857A-3529-4375-985D-D748F9F01476}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{491A857A-3529-4375-985D-D748F9F01476}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{491A857A-3529-4375-985D-D748F9F01476}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{491A857A-3529-4375-985D-D748F9F01476}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{F0CABFE8-A5B1-487B-A451-A486D26742D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{F0CABFE8-A5B1-487B-A451-A486D26742D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{F0CABFE8-A5B1-487B-A451-A486D26742D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{F0CABFE8-A5B1-487B-A451-A486D26742D3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{15664836-2B94-4D2D-AC18-6DED01FCCCBD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{15664836-2B94-4D2D-AC18-6DED01FCCCBD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{15664836-2B94-4D2D-AC18-6DED01FCCCBD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{15664836-2B94-4D2D-AC18-6DED01FCCCBD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{E1E9BC7A-6951-4B60-8DFB-DBB9AC3CDEB0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{E1E9BC7A-6951-4B60-8DFB-DBB9AC3CDEB0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{E1E9BC7A-6951-4B60-8DFB-DBB9AC3CDEB0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{E1E9BC7A-6951-4B60-8DFB-DBB9AC3CDEB0}.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}
|
||||||
|
{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}
|
||||||
|
{2849A2D9-7C08-4198-BF2B-8BFB4B13554D} = {FF9B744E-6C59-40CC-9E41-9D2EBD292435}
|
||||||
|
{33E245F0-2566-4B5B-BA7C-8895B7A697AE} = {37237C93-6855-40D9-9E60-418B093EF49A}
|
||||||
|
{9B22E525-FEC9-4C7C-9F9C-598C15BD0250} = {FF9B744E-6C59-40CC-9E41-9D2EBD292435}
|
||||||
|
{1CE2D76B-39E6-46C0-8F6F-C63E370955A9} = {FF9B744E-6C59-40CC-9E41-9D2EBD292435}
|
||||||
|
{0899A101-E451-40A4-81B0-7AA18202C25D} = {CD650B4B-81C2-4A44-AEF2-A251A877C1F0}
|
||||||
|
{2B2C37FF-9249-4EA4-9A7F-038B55A15C2C} = {CD650B4B-81C2-4A44-AEF2-A251A877C1F0}
|
||||||
|
{809AEE05-1B28-4E31-8959-776B249BD725} = {CD650B4B-81C2-4A44-AEF2-A251A877C1F0}
|
||||||
|
{491A857A-3529-4375-985D-D748F9F01476} = {CD650B4B-81C2-4A44-AEF2-A251A877C1F0}
|
||||||
|
{F0CABFE8-A5B1-487B-A451-A486D26742D3} = {FF9B744E-6C59-40CC-9E41-9D2EBD292435}
|
||||||
|
{15664836-2B94-4D2D-AC18-6DED01FCCCBD} = {CD650B4B-81C2-4A44-AEF2-A251A877C1F0}
|
||||||
|
{E1E9BC7A-6951-4B60-8DFB-DBB9AC3CDEB0} = {FF9B744E-6C59-40CC-9E41-9D2EBD292435}
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {5743DFE7-1AA5-439D-84AE-A480EA389927}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
<Project>
|
||||||
|
<Import
|
||||||
|
Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), AspNetCoreSettings.props))\AspNetCoreSettings.props"
|
||||||
|
Condition=" '$(CI)' != 'true' AND '$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), AspNetCoreSettings.props))' != '' " />
|
||||||
|
|
||||||
|
<Import Project="version.props" />
|
||||||
|
<Import Project="build\dependencies.props" />
|
||||||
|
<Import Project="build\sources.props" />
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<Product>Microsoft ASP.NET Core</Product>
|
||||||
|
<RepositoryUrl>https://github.com/aspnet/AzureIntegration</RepositoryUrl>
|
||||||
|
<RepositoryType>git</RepositoryType>
|
||||||
|
<RepositoryRoot>$(MSBuildThisFileDirectory)</RepositoryRoot>
|
||||||
|
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)build\Key.snk</AssemblyOriginatorKeyFile>
|
||||||
|
<SignAssembly>true</SignAssembly>
|
||||||
|
<PublicSign Condition="'$(OS)' != 'Windows_NT'">true</PublicSign>
|
||||||
|
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
<Project>
|
||||||
|
<PropertyGroup>
|
||||||
|
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">$(MicrosoftNETCoreApp20PackageVersion)</RuntimeFrameworkVersion>
|
||||||
|
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp2.1' ">$(MicrosoftNETCoreApp21PackageVersion)</RuntimeFrameworkVersion>
|
||||||
|
<NETStandardImplicitPackageVersion Condition=" '$(TargetFramework)' == 'netstandard2.0' ">$(NETStandardLibrary20PackageVersion)</NETStandardImplicitPackageVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"adx": { // Packages written by the ADX team and that ship on NuGet.org
|
||||||
|
"rules": [
|
||||||
|
"AdxVerificationCompositeRule"
|
||||||
|
],
|
||||||
|
"packages": {
|
||||||
|
"Microsoft.AspNetCore.AzureAppServicesIntegration": { },
|
||||||
|
"Microsoft.Extensions.ApplicationModelDetection": { }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Default": { // Rules to run for packages not listed in any other set.
|
||||||
|
"rules": [
|
||||||
|
"DefaultCompositeRule"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
AzureIntegration
|
||||||
|
===
|
||||||
|
|
||||||
|
Features that integrate ASP.NET Core with Azure.
|
||||||
|
|
||||||
|
This project is part of ASP.NET Core. You can find samples, documentation and getting started instructions for ASP.NET Core at the [Home](https://github.com/aspnet/home) repo.
|
||||||
|
|
||||||
|
|
||||||
|
SiteExtensions
|
||||||
|
===
|
||||||
|
|
||||||
|
To install a nightly preview of the ASP.NET Core runtime site extension for testing purposes:
|
||||||
|
1. In the Azure portal select App Services -> your site -> Application settings
|
||||||
|
1. Set `SCM_SITEEXTENSIONS_FEED_URL` application setting to `https://dotnet.myget.org/F/aspnetcore-dev/`
|
||||||
|
1. Go to `DEVELOPMENT TOOLS` -> `Advanced Tools` -> `Site extensions` -> `Gallery`
|
||||||
|
1. Enter `AspNetCoreRuntime` into `Search` box and click `Search`
|
||||||
|
1. Click `+` to install site extension and wait untill installation animation finishes
|
||||||
|
1. `Extensions` tab should now show newly installed site extension
|
||||||
|
1. Click `Restart site` on the right side of the page when installation finishes (this would only restart Kudu site, not the main one)
|
||||||
|
1. Restart site in `Overview` tab of `App service`
|
||||||
|
|
||||||
|
|
||||||
|
To update ASP.NET Core runtime site extension:
|
||||||
|
1. Stop site in `Overview` tab of `App service`
|
||||||
|
1. Go to `DEVELOPMENT TOOLS` -> `Advanced Tools` -> `Site extensions`
|
||||||
|
1. Click update on site extension
|
||||||
|
1. Start site in `Overview` tab of `App service`
|
||||||
Binary file not shown.
|
|
@ -0,0 +1,45 @@
|
||||||
|
<Project>
|
||||||
|
<PropertyGroup>
|
||||||
|
<PackageDependsOn>$(PackageDependsOn);PackSiteExtensionFiles</PackageDependsOn>
|
||||||
|
<MSBuildProjectFiles>$(MSBuildProjectFiles);$(MSBuildThisFileFullPath)</MSBuildProjectFiles>
|
||||||
|
|
||||||
|
<SiteExtensionOobArchive>$(BuildDir)runtime-site-extension-internal-$(PackageVersion).zip</SiteExtensionOobArchive>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ArtifactInfo Include="$(SiteExtensionOobArchive)">
|
||||||
|
<ArtifactType>ZipArchive</ArtifactType>
|
||||||
|
<RepositoryRoot>$(RepositoryRoot)</RepositoryRoot>
|
||||||
|
<Category>shipoob</Category>
|
||||||
|
</ArtifactInfo>
|
||||||
|
<FilesToSign Include="$(SiteExtensionOobArchive)" IsContainer="true" />
|
||||||
|
<FilesToSign Include="content/Microsoft.Web.Xdt.Extensions.dll" Container="$(SiteExtensionOobArchive)" Certificate="$(AssemblySigningCertName)" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<Target Name="PackSiteExtensionFiles"
|
||||||
|
DependsOnTargets="Compile;_CollectSiteExtensionFiles"
|
||||||
|
Inputs="@(SiteExtensionFile);$(MSBuildProjectFiles)"
|
||||||
|
Outputs="$(SiteExtensionOobArchive)">
|
||||||
|
|
||||||
|
<ZipArchive
|
||||||
|
SourceFiles="@(SiteExtensionFile)"
|
||||||
|
WorkingDirectory="$(SiteExtBasePath)"
|
||||||
|
File="$(SiteExtensionOobArchive)"
|
||||||
|
Overwrite="True" />
|
||||||
|
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
<Target Name="_CollectSiteExtensionFiles">
|
||||||
|
<PropertyGroup>
|
||||||
|
<SiteExtBasePath>$(RepositoryRoot)extensions\Microsoft.AspNetCore.Runtime.SiteExtension\</SiteExtBasePath>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<SiteExtensionFile Include="$(RepositoryRoot)src\Microsoft.Web.Xdt.Extensions\bin\$(Configuration)\net461\Microsoft.Web.Xdt.Extensions.dll"
|
||||||
|
Link="content/Microsoft.Web.Xdt.Extensions.dll" />
|
||||||
|
<SiteExtensionFile Include="$(SiteExtBasePath)install.cmd"
|
||||||
|
Link="content/install.cmd" />
|
||||||
|
<SiteExtensionFile Include="$(SiteExtBasePath)applicationHost.xdt"
|
||||||
|
Link="content/applicationHost.xdt" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Target>
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
<Project>
|
||||||
|
<PropertyGroup>
|
||||||
|
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<!-- These package versions may be overridden or updated by automation. -->
|
||||||
|
<PropertyGroup Label="Package Versions: Auto">
|
||||||
|
<InternalAspNetCoreSdkPackageVersion>2.1.3-rtm-15802</InternalAspNetCoreSdkPackageVersion>
|
||||||
|
<InternalAspNetCoreSiteExtensionSdkPackageVersion>2.1.1-rtm-15793</InternalAspNetCoreSiteExtensionSdkPackageVersion>
|
||||||
|
<MicrosoftApplicationInsightsAspNetCorePackageVersion>2.1.1</MicrosoftApplicationInsightsAspNetCorePackageVersion>
|
||||||
|
<MicrosoftAspNetCoreAzureKeyVaultHostingStartupPackageVersion>2.1.0-preview2-30187</MicrosoftAspNetCoreAzureKeyVaultHostingStartupPackageVersion>
|
||||||
|
<MicrosoftAzureManagementFluentPackageVersion>1.1.3</MicrosoftAzureManagementFluentPackageVersion>
|
||||||
|
<MicrosoftAzureServicesAppAuthenticationPackageVersion>1.0.1</MicrosoftAzureServicesAppAuthenticationPackageVersion>
|
||||||
|
<MicrosoftNETCoreApp20PackageVersion>2.0.0</MicrosoftNETCoreApp20PackageVersion>
|
||||||
|
<MicrosoftNETCoreApp21PackageVersion>2.1.2</MicrosoftNETCoreApp21PackageVersion>
|
||||||
|
<MicrosoftNETTestSdkPackageVersion>15.6.1</MicrosoftNETTestSdkPackageVersion>
|
||||||
|
<MicrosoftWebXdtPackageVersion>1.4.0</MicrosoftWebXdtPackageVersion>
|
||||||
|
<MoqPackageVersion>4.7.49</MoqPackageVersion>
|
||||||
|
<NETStandardLibrary20PackageVersion>2.0.3</NETStandardLibrary20PackageVersion>
|
||||||
|
<NewtonsoftJsonPackageVersion>11.0.2</NewtonsoftJsonPackageVersion>
|
||||||
|
<SystemReflectionMetadataPackageVersion>1.6.0</SystemReflectionMetadataPackageVersion>
|
||||||
|
<WindowsAzureStoragePackageVersion>8.1.4</WindowsAzureStoragePackageVersion>
|
||||||
|
<XunitPackageVersion>2.3.1</XunitPackageVersion>
|
||||||
|
<XunitRunnerVisualStudioPackageVersion>2.4.0-beta.1.build3945</XunitRunnerVisualStudioPackageVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<!-- This may import a generated file which may override the variables above. -->
|
||||||
|
<Import Project="$(DotNetPackageVersionPropsPath)" Condition=" '$(DotNetPackageVersionPropsPath)' != '' " />
|
||||||
|
|
||||||
|
<!-- These are package versions that should not be overridden or updated by automation. -->
|
||||||
|
<PropertyGroup Label="Package Versions: Pinned">
|
||||||
|
<MicrosoftAspNetCoreAppPackageVersion>2.1.2</MicrosoftAspNetCoreAppPackageVersion>
|
||||||
|
<MicrosoftAspNetCoreAspNetCoreModulePackageVersion>2.1.1</MicrosoftAspNetCoreAspNetCoreModulePackageVersion>
|
||||||
|
<MicrosoftAspNetCoreAzureAppServicesHostingStartupPackageVersion>2.1.1</MicrosoftAspNetCoreAzureAppServicesHostingStartupPackageVersion>
|
||||||
|
<MicrosoftAspNetCoreDataProtectionAzureKeyVaultPackageVersion>2.1.1</MicrosoftAspNetCoreDataProtectionAzureKeyVaultPackageVersion>
|
||||||
|
<MicrosoftAspNetCoreHostingAbstractionsPackageVersion>2.1.1</MicrosoftAspNetCoreHostingAbstractionsPackageVersion>
|
||||||
|
<MicrosoftAspNetCoreHostingPackageVersion>2.1.1</MicrosoftAspNetCoreHostingPackageVersion>
|
||||||
|
<MicrosoftAspNetCoreMvcPackageVersion>2.1.1</MicrosoftAspNetCoreMvcPackageVersion>
|
||||||
|
<MicrosoftAspNetCoreRazorRuntimePackageVersion>2.1.1</MicrosoftAspNetCoreRazorRuntimePackageVersion>
|
||||||
|
<MicrosoftAspNetCoreServerIISIntegrationPackageVersion>2.1.1</MicrosoftAspNetCoreServerIISIntegrationPackageVersion>
|
||||||
|
<MicrosoftAspNetCoreServerIntegrationTestingPackageVersion>0.5.1</MicrosoftAspNetCoreServerIntegrationTestingPackageVersion>
|
||||||
|
<MicrosoftAspNetCoreServerKestrelPackageVersion>2.1.2</MicrosoftAspNetCoreServerKestrelPackageVersion>
|
||||||
|
<MicrosoftAspNetCoreTestHostPackageVersion>2.1.1</MicrosoftAspNetCoreTestHostPackageVersion>
|
||||||
|
<MicrosoftExtensionsConfigurationAzureKeyVaultPackageVersion>2.1.1</MicrosoftExtensionsConfigurationAzureKeyVaultPackageVersion>
|
||||||
|
<MicrosoftExtensionsConfigurationCommandLinePackageVersion>2.1.1</MicrosoftExtensionsConfigurationCommandLinePackageVersion>
|
||||||
|
<MicrosoftExtensionsConfigurationEnvironmentVariablesPackageVersion>2.1.1</MicrosoftExtensionsConfigurationEnvironmentVariablesPackageVersion>
|
||||||
|
<MicrosoftExtensionsConfigurationJsonPackageVersion>2.1.1</MicrosoftExtensionsConfigurationJsonPackageVersion>
|
||||||
|
<MicrosoftExtensionsDiagnosticAdapterPackageVersion>2.1.0</MicrosoftExtensionsDiagnosticAdapterPackageVersion>
|
||||||
|
<MicrosoftExtensionsLoggingAzureAppServicesPackageVersion>2.1.1</MicrosoftExtensionsLoggingAzureAppServicesPackageVersion>
|
||||||
|
<MicrosoftExtensionsLoggingConfigurationPackageVersion>2.1.1</MicrosoftExtensionsLoggingConfigurationPackageVersion>
|
||||||
|
<MicrosoftExtensionsLoggingConsolePackageVersion>2.1.1</MicrosoftExtensionsLoggingConsolePackageVersion>
|
||||||
|
<MicrosoftExtensionsLoggingPackageVersion>2.1.1</MicrosoftExtensionsLoggingPackageVersion>
|
||||||
|
<MicrosoftExtensionsLoggingTestingPackageVersion>2.1.1</MicrosoftExtensionsLoggingTestingPackageVersion>
|
||||||
|
<MicrosoftExtensionsProcessSourcesPackageVersion>2.1.1</MicrosoftExtensionsProcessSourcesPackageVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
<Project>
|
||||||
|
<Target Name="PackTaskDependencies" BeforeTargets="GenerateNuspec">
|
||||||
|
<ItemGroup>
|
||||||
|
<_PackageFiles Include="$(ProjectDepsFilePath)">
|
||||||
|
<PackagePath>lib\$(TargetFramework)</PackagePath>
|
||||||
|
<Visible>false</Visible>
|
||||||
|
<BuildAction>Content</BuildAction>
|
||||||
|
</_PackageFiles>
|
||||||
|
</ItemGroup>
|
||||||
|
</Target>
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
<Project>
|
||||||
|
<Import Project="dependencies.props" />
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<AssemblySigningCertName>Microsoft</AssemblySigningCertName>
|
||||||
|
|
||||||
|
<FunctionalTestsProject>$(RepositoryRoot)test\Microsoft.AspNetCore.AzureAppServices.FunctionalTests\Microsoft.AspNetCore.AzureAppServices.FunctionalTests.csproj</FunctionalTestsProject>
|
||||||
|
|
||||||
|
<!-- These properties are use by the automation that updates dependencies.props -->
|
||||||
|
<LineupPackageId>Internal.AspNetCore.Universe.Lineup</LineupPackageId>
|
||||||
|
<LineupPackageVersion>2.1.0-rc1-*</LineupPackageVersion>
|
||||||
|
<LineupPackageRestoreSource>https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json</LineupPackageRestoreSource>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<SiteExtensions Include="$(RepositoryRoot)extensions\Microsoft.AspNetCore.AzureAppServices.SiteExtension\Microsoft.AspNetCore.AzureAppServices.SiteExtension.csproj" PackageName="Microsoft.AspNetCore.AzureAppServices.SiteExtension.2.1" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ExcludeFromTest
|
||||||
|
Condition="'$(AntaresTests)' != ''"
|
||||||
|
Include="$(RepositoryRoot)test\*\*.csproj"
|
||||||
|
Exclude="$(FunctionalTestsProject)" />
|
||||||
|
|
||||||
|
<ExcludeFromTest
|
||||||
|
Condition="'$(AntaresTests)' == ''"
|
||||||
|
Include="$(FunctionalTestsProject)" />
|
||||||
|
|
||||||
|
<ExcludeFromTest Include="$(RepositoryRoot)test\Microsoft.AspNetCore.AzureAppServices.SiteExtension.Tests\*.csproj" Condition="'$(OS)' != 'Windows_NT'" />
|
||||||
|
<ExcludeFromTest Include="$(RepositoryRoot)test\Microsoft.Web.Xdt.Extensions.Tests\*.csproj" Condition="'$(OS)' != 'Windows_NT'" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<DotNetCoreRuntime Include="$(MicrosoftNETCoreApp20PackageVersion)" />
|
||||||
|
<DotNetCoreRuntime Include="$(MicrosoftNETCoreApp21PackageVersion)" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,140 @@
|
||||||
|
<Project>
|
||||||
|
<Import Project="PackSiteExtension.targets" />
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<ComposeSdk Condition="$(SITE_EXTENSION_SDK_VERSION) == ''">True</ComposeSdk>
|
||||||
|
<_SdkVersion>$(SITE_EXTENSION_SDK_VERSION)</_SdkVersion>
|
||||||
|
<_SdkVersion Condition="'$(_SdkVersion)' == ''">$([System.IO.Path]::GetFileName($([System.IO.Path]::GetDirectoryName('$(MSBuildExtensionsPath)'))))</_SdkVersion>
|
||||||
|
<_SdkFeed>$(SITE_EXTENSION_SDK_FEED)</_SdkFeed>
|
||||||
|
<_SdkFeed Condition="'$(_SdkFeed)' == ''">$(DefaultDotNetAssetFeed)</_SdkFeed>
|
||||||
|
<TestDotNetPath>$(RepositoryRoot).test-dotnet\</TestDotNetPath>
|
||||||
|
<AppsArtifactDirectory>$(RepositoryRoot)artifacts\apps</AppsArtifactDirectory>
|
||||||
|
<SiteExtensionWorkingDirectory>$(TestDotNetPath)extension\$(SiteExtensionArch)\</SiteExtensionWorkingDirectory>
|
||||||
|
<SiteExtensionOutputDirectory>$(RepositoryRoot)artifacts\build</SiteExtensionOutputDirectory>
|
||||||
|
<TestProjectDirectory>$(RepositoryRoot)\test\Microsoft.AspNetCore.AzureAppServices.FunctionalTests\</TestProjectDirectory>
|
||||||
|
<SiteExtensionFeed Condition="$(SiteExtensionFeed) == ''">https://dotnet.myget.org/F/aspnetcore-dev/</SiteExtensionFeed>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<Target Name="_AddTestRuntimes">
|
||||||
|
<ItemGroup>
|
||||||
|
<DotNetCoreSdk Include="2.0.0" InstallDir="$(TestDotNetPath)2.0\" FallbackPackageCache="True" />
|
||||||
|
<DotNetCoreSdk Include="$(_SdkVersion)" InstallDir="$(TestDotNetPath)latest\" FallbackPackageCache="True" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
<Target Name="_CleanSiteExtension">
|
||||||
|
<RemoveDir Directories="$(SiteExtensionWorkingDirectory)" Condition="Exists($(SiteExtensionWorkingDirectory))" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
<Target Name="_AddSiteExtensionSdk">
|
||||||
|
<ItemGroup>
|
||||||
|
<DotNetCoreSdk Include="$(_SdkVersion)" Feed="$(_SdkFeed)" InstallDir="$(SiteExtensionWorkingDirectory)" Arch="$(SiteExtensionArch)" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
<Target Name="_AddSiteExtensionRuntime">
|
||||||
|
<ItemGroup>
|
||||||
|
<DotNetCoreRuntime
|
||||||
|
Include="$(MicrosoftNETCoreApp21PackageVersion)"
|
||||||
|
InstallDir="$(SiteExtensionWorkingDirectory)"
|
||||||
|
Arch="$(SiteExtensionArch)"
|
||||||
|
Feed="$(DotNetAssetRootUrl)"
|
||||||
|
FeedCredential="$(DotNetAssetRootAccessTokenSuffix)" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
<Target Name="ComposeSiteExtensions" Condition="'$(ComposeSdk)' == 'True'" DependsOnTargets="_AddSiteExtensionSdk;_AddSiteExtensionRuntime;InstallDotNet">
|
||||||
|
<ItemGroup>
|
||||||
|
<RuntimeArchiveItems Include="$(RuntimeArchives)" />
|
||||||
|
<DotNetCacheArchiveItems Include="$(DotNetCacheArchives)" />
|
||||||
|
|
||||||
|
<_CleanupFiles
|
||||||
|
Include="$(SiteExtensionWorkingDirectory)additionalDeps;$(SiteExtensionWorkingDirectory)store" />
|
||||||
|
|
||||||
|
<_CleanupFiles
|
||||||
|
Include="$([System.IO.Directory]::GetDirectories('$(SiteExtensionWorkingDirectory)shared\Microsoft.NETCore.App\'))"
|
||||||
|
Exclude="$(SiteExtensionWorkingDirectory)shared\Microsoft.NETCore.App\$(MicrosoftNETCoreApp21PackageVersion)" />
|
||||||
|
|
||||||
|
<_CleanupFiles
|
||||||
|
Condition="Exists('$(SiteExtensionWorkingDirectory)shared\Microsoft.AspNetCore.App\')"
|
||||||
|
Include="$([System.IO.Directory]::GetDirectories('$(SiteExtensionWorkingDirectory)shared\Microsoft.AspNetCore.App\'))"
|
||||||
|
Exclude="$(SiteExtensionWorkingDirectory)shared\Microsoft.AspNetCore.App\$(PackageVersion)" />
|
||||||
|
|
||||||
|
<_CleanupFiles
|
||||||
|
Include="$([System.IO.Directory]::GetDirectories('$(SiteExtensionWorkingDirectory)shared\Microsoft.AspNetCore.All\'))"
|
||||||
|
Exclude="$(SiteExtensionWorkingDirectory)shared\Microsoft.AspNetCore.All\$(PackageVersion)" />
|
||||||
|
|
||||||
|
<_CleanupFiles
|
||||||
|
Include="$([System.IO.Directory]::GetDirectories('$(SiteExtensionWorkingDirectory)host\fxr'))"
|
||||||
|
Exclude="$(SiteExtensionWorkingDirectory)host\fxr\$(MicrosoftNETCoreApp21PackageVersion)" />
|
||||||
|
|
||||||
|
<BundledTemplate Include="Microsoft.DotNet.Web.ItemTemplates" Version="$(PackageVersion)" />
|
||||||
|
<BundledTemplate Include="Microsoft.DotNet.Web.ProjectTemplates.2.1" Version="$(PackageVersion)" />
|
||||||
|
<BundledTemplate Include="Microsoft.DotNet.Web.Spa.ProjectTemplates" Version="$(PackageVersion)" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<Message Text="Removing %(_CleanupFiles.Identity)" Importance="High" />
|
||||||
|
<RemoveDir Directories="@(_CleanupFiles)" />
|
||||||
|
|
||||||
|
<UnzipArchive File="$(ArtifactDependencyLocation)\aspnetcore-runtime-internal-$(PackageVersion)-win-$(SiteExtensionArch).zip" Destination="$(SiteExtensionWorkingDirectory)" Overwrite="true" />
|
||||||
|
<UnzipArchive File="%(RuntimeArchiveItems.Identity)" Destination="$(SiteExtensionWorkingDirectory)" Condition="'$(RuntimeArchives)' != ''" Overwrite="true" />
|
||||||
|
<UnzipArchive File="%(DotNetCacheArchiveItems.Identity)" Destination="$(SiteExtensionWorkingDirectory)DotNetCache" Condition="'$(DotNetCacheArchives)' != ''" Overwrite="true" />
|
||||||
|
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
<Target Name="PrepareSiteExtensionSdk" DependsOnTargets="ComposeSiteExtensions;_AddSiteExtensionSdk;InstallDotNet">
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
<Target Name="PrepareSiteExtensionSdks">
|
||||||
|
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="PrepareSiteExtensionSdk" Properties="SiteExtensionArch=x86" />
|
||||||
|
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="PrepareSiteExtensionSdk" Properties="SiteExtensionArch=x64" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
<Target Name="BuildSiteExtension">
|
||||||
|
|
||||||
|
<MSBuild Projects="%(SiteExtensions.Identity)"
|
||||||
|
Targets="Restore"
|
||||||
|
Properties="BuildNumber=$(BuildNumber)" />
|
||||||
|
|
||||||
|
<MSBuild Projects="%(SiteExtensions.Identity)"
|
||||||
|
Targets="Pack"
|
||||||
|
Properties="%(SiteExtensions.BuildProperties);DotnetHomeDirectory=$(SiteExtensionWorkingDirectory);BuildNumber=$(BuildNumber);PackageOutputPath=$(SiteExtensionOutputDirectory)" />
|
||||||
|
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
<Target Name="PushSiteExtension" DependsOnTargets="BuildSiteExtension">
|
||||||
|
<ItemGroup>
|
||||||
|
<RepositoryNupkgs Include="$(SiteExtensionOutputDirectory)\%(SiteExtensions.PackageName).*.nupkg" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<PushNuGetPackages
|
||||||
|
Packages="@(RepositoryNupkgs)"
|
||||||
|
Feed="$(SiteExtensionFeed)"
|
||||||
|
ApiKey="$(APIKey)"
|
||||||
|
TimeoutSeconds="600"/>
|
||||||
|
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
<Target Name="TestSiteExtension" DependsOnTargets="_AddTestRuntimes;InstallDotNet;Restore">
|
||||||
|
|
||||||
|
<Copy SourceFiles="$(TestProjectDirectory)NuGet.config.template" DestinationFiles="$(RepositoryRoot)artifacts\NuGet.config" />
|
||||||
|
<Copy SourceFiles="$(TestProjectDirectory)global.json.template" DestinationFiles="$(RepositoryRoot)artifacts\global.json" />
|
||||||
|
<Copy SourceFiles="$(TestProjectDirectory)Directory.Build.props.template" DestinationFiles="$(RepositoryRoot)artifacts\Directory.Build.props" />
|
||||||
|
<Copy SourceFiles="$(TestProjectDirectory)Directory.Build.targets.template" DestinationFiles="$(RepositoryRoot)artifacts\Directory.Build.targets" />
|
||||||
|
|
||||||
|
<Exec Command="%(DotNetCoreSdk.InstallDir)dotnet msbuild /version" WorkingDirectory="$(RepositoryRoot)artifacts\" />
|
||||||
|
|
||||||
|
<Exec Command="dotnet run" WorkingDirectory="$(TestProjectDirectory)"/>
|
||||||
|
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
<Target Name="CleanArtifactsApplications" BeforeTargets="CleanArtifacts" >
|
||||||
|
<!--
|
||||||
|
git deploy creates read-only files which msbuild is unable to remove
|
||||||
|
NOTE: we run tests only on windows
|
||||||
|
-->
|
||||||
|
<Exec Command="rmdir /S /Q "$(AppsArtifactDirectory)"" Condition="Exists($(AppsArtifactDirectory))" />
|
||||||
|
<RemoveDir Directories="$(SiteExtensionOutputDirectory)" Condition="Exists($(SiteExtensionOutputDirectory))" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
<Project>
|
||||||
|
<Import Project="$(DotNetRestoreSourcePropsPath)" Condition="'$(DotNetRestoreSourcePropsPath)' != ''"/>
|
||||||
|
|
||||||
|
<PropertyGroup Label="RestoreSources">
|
||||||
|
<RestoreSources>$(DotNetRestoreSources)</RestoreSources>
|
||||||
|
<RestoreSources Condition="'$(DotNetBuildOffline)' != 'true' AND '$(AspNetUniverseBuildOffline)' != 'true' ">
|
||||||
|
$(RestoreSources);
|
||||||
|
https://dotnet.myget.org/F/dotnet-core/api/v3/index.json;
|
||||||
|
https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json;
|
||||||
|
https://dotnet.myget.org/F/aspnetcore-tools/api/v3/index.json;
|
||||||
|
</RestoreSources>
|
||||||
|
<RestoreSources Condition="'$(DotNetBuildOffline)' != 'true'">
|
||||||
|
$(RestoreSources);
|
||||||
|
https://api.nuget.org/v3/index.json;
|
||||||
|
</RestoreSources>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
<Project>
|
||||||
|
<Import Project="..\Directory.Build.props" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net461</TargetFramework>
|
||||||
|
<GenerateDocumentationFile>false</GenerateDocumentationFile>
|
||||||
|
<PackageType>AzureSiteExtension</PackageType>
|
||||||
|
<NoPackageAnalysis>true</NoPackageAnalysis>
|
||||||
|
<IncludeBuildOutput>false</IncludeBuildOutput>
|
||||||
|
<IncludeSymbols>false</IncludeSymbols>
|
||||||
|
<IncludeSource>false</IncludeSource>
|
||||||
|
<ContentTargetFolders>content</ContentTargetFolders>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Internal.AspNetCore.Sdk" PrivateAssets="All" Version="$(InternalAspNetCoreSdkPackageVersion)" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TrimmedVersion>$(VersionPrefix.Substring(0, $(VersionPrefix.LastIndexOf('.'))))</TrimmedVersion>
|
||||||
|
<title>ASP.NET Core Extensions</title>
|
||||||
|
<Description>This extension enables additional functionality for ASP.NET Core on Azure WebSites, such as enabling Azure logging.</Description>
|
||||||
|
<TargetFramework>net461</TargetFramework>
|
||||||
|
<GenerateDocumentationFile>false</GenerateDocumentationFile>
|
||||||
|
<PackageTags>aspnet;logging;aspnetcore;AzureSiteExtension;keyvault;configuration;dataprotection</PackageTags>
|
||||||
|
<ContentTargetFolders>content</ContentTargetFolders>
|
||||||
|
<HostingStartupRuntimeFrameworkVersion>$(MicrosoftNETCoreApp21PackageVersion)</HostingStartupRuntimeFrameworkVersion>
|
||||||
|
<PackageId>Microsoft.AspNetCore.AzureAppServices.SiteExtension.$(TrimmedVersion)</PackageId>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="applicationHost.xdt" />
|
||||||
|
<Content Include="scmApplicationHost.xdt" />
|
||||||
|
<Content Include="bin\$(Configuration)\$(TargetFramework)\Microsoft.Web.Xdt.Extensions.dll" PackagePath="content" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\src\Microsoft.Web.Xdt.Extensions\Microsoft.Web.Xdt.Extensions.csproj" PrivateAssets="All" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<HostingStartupPackageReference Include="Microsoft.AspNetCore.AzureAppServices.HostingStartup" Version="$(MicrosoftAspNetCoreAzureAppServicesHostingStartupPackageVersion)" />
|
||||||
|
|
||||||
|
<PackageReference Include="Internal.AspNetCore.SiteExtension.Sdk" Version="$(InternalAspNetCoreSiteExtensionSdkPackageVersion)" PrivateAssets="All" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
|
||||||
|
|
||||||
|
<xdt:Import path="%XDT_EXTENSIONPATH%\Microsoft.Web.Xdt.Extensions.dll"
|
||||||
|
namespace="Microsoft.Web.Xdt.Extensions" />
|
||||||
|
|
||||||
|
<system.webServer xdt:Transform="InsertIfMissing">
|
||||||
|
<runtime xdt:Transform="InsertIfMissing" >
|
||||||
|
<environmentVariables xdt:Transform="InsertIfMissing">
|
||||||
|
<add name="DOTNET_ADDITIONAL_DEPS" value="%XDT_EXTENSIONPATH%\additionalDeps\Microsoft.AspNetCore.AzureAppServices.HostingStartup\;%ProgramFiles%\dotnet\additionalDeps\Microsoft.AspNetCore.AzureAppServices.HostingStartup\" xdt:Locator="Match(name)" xdt:Transform="InsertOrAppendAttribute(Attribute='value')" />
|
||||||
|
<add name="DOTNET_SHARED_STORE" value="%XDT_EXTENSIONPATH%\store" xdt:Locator="Match(name)" xdt:Transform="InsertOrAppendAttribute(Attribute='value')" />
|
||||||
|
<add name="ASPNETCORE_HOSTINGSTARTUPASSEMBLIES" value="Microsoft.AspNetCore.AzureAppServices.HostingStartup" xdt:Locator="Match(name)" xdt:Transform="InsertOrAppendAttribute(Attribute='value')" />
|
||||||
|
</environmentVariables>
|
||||||
|
</runtime>
|
||||||
|
</system.webServer>
|
||||||
|
</configuration>
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
|
||||||
|
<!-- This file exists to prevent applicationHost.xdt from being applied to scm host that runs
|
||||||
|
other dotnet processes (dotnet build, csc etc. )-->
|
||||||
|
</configuration>
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TrimmedVersion>$(VersionPrefix.Substring(0, $(VersionPrefix.LastIndexOf('.'))))</TrimmedVersion>
|
||||||
|
<Title>ASP.NET Core $(TrimmedVersion) ($(RuntimeArch)) Runtime </Title>
|
||||||
|
<Description>This site extension installs Microsoft.AspNetCore.All, Microsoft.AspNetCore.App and Microsoft.NetCore.App shared runtimes.</Description>
|
||||||
|
<PackageTags>aspnetcore;AzureSiteExtension</PackageTags>
|
||||||
|
<PackageId>AspNetCoreRuntime.$(TrimmedVersion).$(RuntimeArch)</PackageId>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="applicationHost.xdt" />
|
||||||
|
<Content Include="install.cmd" />
|
||||||
|
<Content Include="$(OutputPath)\Microsoft.Web.Xdt.Extensions.dll" PackagePath="content" />
|
||||||
|
|
||||||
|
<Content Include="$(DotnetHomeDirectory)\$(RuntimeArch)\**\*.*" Condition="$(DotnetHomeDirectory) != ''" PackagePath="content\%(RecursiveDir)%(FileName)%(Extension)" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\src\Microsoft.Web.Xdt.Extensions\Microsoft.Web.Xdt.Extensions.csproj" PrivateAssets="All" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
|
||||||
|
|
||||||
|
<xdt:Import path="%XDT_EXTENSIONPATH%\Microsoft.Web.Xdt.Extensions.dll"
|
||||||
|
namespace="Microsoft.Web.Xdt.Extensions" />
|
||||||
|
|
||||||
|
<system.webServer xdt:Transform="InsertIfMissing">
|
||||||
|
<runtime xdt:Transform="InsertIfMissing" >
|
||||||
|
<environmentVariables xdt:Transform="InsertIfMissing">
|
||||||
|
<add name="PATH" value="%XDT_EXTENSIONPATH%;%USERPROFILE%\.dotnet\tools;%PATH%" xdt:Locator="Match(name)" xdt:Transform="InsertIfMissing" />
|
||||||
|
<add name="DOTNET_SKIP_FIRST_TIME_EXPERIENCE" value="1" xdt:Locator="Match(name)" xdt:Transform="InsertIfMissing" />
|
||||||
|
</environmentVariables>
|
||||||
|
</runtime>
|
||||||
|
</system.webServer>
|
||||||
|
</configuration>
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
FOR /R %%x IN (*.nupkg_) DO REN "%%x" "*.nupkg"
|
||||||
|
|
||||||
|
|
||||||
|
SET DOTNET=D:\Program Files (x86)\dotnet
|
||||||
|
SET RUNTIMES=%DOTNET%\shared\Microsoft.NETCore.App
|
||||||
|
|
||||||
|
IF "%ASPNETCORE_COPY_EXISTING_RUNTIMES%" NEQ "1" EXIT /b 0
|
||||||
|
|
||||||
|
robocopy "%DOTNET%" "." /E /XC /XN /XO /NFL /NDL ^
|
||||||
|
/XD "%DOTNET%\sdk" ^
|
||||||
|
/XD "%RUNTIMES%\1.0.8" ^
|
||||||
|
/XD "%RUNTIMES%\1.1.5" ^
|
||||||
|
/XD "%RUNTIMES%\2.0.3"
|
||||||
|
|
||||||
|
IF %errorlevel% geq 8 EXIT /b 1
|
||||||
|
EXIT /b 0
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFrameworks>netcoreapp2.1;netcoreapp2.0;net461</TargetFrameworks>
|
||||||
|
<RuntimeIdentifiers>win7-x86;win7-x64;linux-x64;osx-x64</RuntimeIdentifiers>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="$(MicrosoftAspNetCoreHostingPackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="$(MicrosoftAspNetCoreMvcPackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="$(MicrosoftAspNetCoreServerIISIntegrationPackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="$(MicrosoftAspNetCoreServerKestrelPackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="$(MicrosoftExtensionsConfigurationCommandLinePackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(MicrosoftExtensionsLoggingConsolePackageVersion)" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.ApplicationInsights.HostingStartup\Microsoft.AspNetCore.ApplicationInsights.HostingStartup.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="appsettings.json" CopyToOutputDirectory="PreserveNewest" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
// 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.Mvc;
|
||||||
|
|
||||||
|
namespace ApplicationInsightsJavaScriptSnippetSample.Controllers
|
||||||
|
{
|
||||||
|
public class HomeController : Controller
|
||||||
|
{
|
||||||
|
public IActionResult ScriptCheck()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
using System;
|
||||||
|
using Microsoft.ApplicationInsights.Channel;
|
||||||
|
using Microsoft.ApplicationInsights.DataContracts;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
|
||||||
|
namespace IISSample
|
||||||
|
{
|
||||||
|
public class CurrentResponseTelemetryChannel : ITelemetryChannel
|
||||||
|
{
|
||||||
|
private readonly HttpResponse _response;
|
||||||
|
|
||||||
|
public CurrentResponseTelemetryChannel(HttpResponse response)
|
||||||
|
{
|
||||||
|
_response = response;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Send(ITelemetry item)
|
||||||
|
{
|
||||||
|
if (item is TraceTelemetry traceTelemetry)
|
||||||
|
{
|
||||||
|
_response.WriteAsync(traceTelemetry.Message + Environment.NewLine).GetAwaiter().GetResult();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Flush()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool? DeveloperMode { get; set; }
|
||||||
|
public string EndpointAddress { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
{
|
||||||
|
"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.ApplicationInsights.HostingStartup;Microsoft.AspNetCore.Server.IISIntegration"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ApplicationInsightsHostingStartupSample": {
|
||||||
|
"commandName": "project",
|
||||||
|
"launchBrowser": true,
|
||||||
|
"launchUrl": "http://localhost:5000/",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||||
|
"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.ApplicationInsights.HostingStartup"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,97 @@
|
||||||
|
// 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 System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.ApplicationInsights.Extensibility;
|
||||||
|
using Microsoft.AspNetCore.Builder;
|
||||||
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace IISSample
|
||||||
|
{
|
||||||
|
public class Startup
|
||||||
|
{
|
||||||
|
public void ConfigureServices(IServiceCollection services)
|
||||||
|
{
|
||||||
|
services.AddMvc();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ConfigureJavaScript(IApplicationBuilder app)
|
||||||
|
{
|
||||||
|
app.UseMvcWithDefaultRoute();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ConfigureDefaultLogging(IApplicationBuilder app, ILoggerFactory loggerFactory)
|
||||||
|
{
|
||||||
|
ConfigureLoggingMiddleware(app, loggerFactory);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ConfigureCustomLogging(IApplicationBuilder app, ILoggerFactory loggerFactory, IServiceProvider serviceProvider)
|
||||||
|
{
|
||||||
|
loggerFactory.AddApplicationInsights(serviceProvider, (s, level) => s.Contains("o"));
|
||||||
|
ConfigureLoggingMiddleware(app, loggerFactory);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void ConfigureLoggingMiddleware(IApplicationBuilder app, ILoggerFactory loggerFactory)
|
||||||
|
{
|
||||||
|
app.Map("/log", logApp => logApp.Run(context =>
|
||||||
|
{
|
||||||
|
var oldChannel = TelemetryConfiguration.Active.TelemetryChannel;
|
||||||
|
TelemetryConfiguration.Active.TelemetryChannel = new CurrentResponseTelemetryChannel(context.Response);
|
||||||
|
|
||||||
|
var systemLogger = loggerFactory.CreateLogger("System.Namespace");
|
||||||
|
systemLogger.LogTrace("System trace log");
|
||||||
|
systemLogger.LogInformation("System information log");
|
||||||
|
systemLogger.LogWarning("System warning log");
|
||||||
|
|
||||||
|
var microsoftLogger = loggerFactory.CreateLogger("Microsoft.Namespace");
|
||||||
|
microsoftLogger.LogTrace("Microsoft trace log");
|
||||||
|
microsoftLogger.LogInformation("Microsoft information log");
|
||||||
|
microsoftLogger.LogWarning("Microsoft warning log");
|
||||||
|
|
||||||
|
var customLogger = loggerFactory.CreateLogger("Custom.Namespace");
|
||||||
|
customLogger.LogTrace("Custom trace log");
|
||||||
|
customLogger.LogInformation("Custom information log");
|
||||||
|
customLogger.LogWarning("Custom warning log");
|
||||||
|
|
||||||
|
var specificLogger = loggerFactory.CreateLogger("Specific.Namespace");
|
||||||
|
specificLogger.LogTrace("Specific trace log");
|
||||||
|
specificLogger.LogInformation("Specific information log");
|
||||||
|
specificLogger.LogWarning("Specific warning log");
|
||||||
|
|
||||||
|
TelemetryConfiguration.Active.TelemetryChannel = oldChannel;
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Main(string[] args)
|
||||||
|
{
|
||||||
|
var config = new ConfigurationBuilder()
|
||||||
|
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
||||||
|
.AddCommandLine(args)
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
var host = new WebHostBuilder()
|
||||||
|
.UseConfiguration(config)
|
||||||
|
.ConfigureLogging((hostingContext, builder) =>
|
||||||
|
{
|
||||||
|
builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
|
||||||
|
builder.AddConsole();
|
||||||
|
})
|
||||||
|
.UseKestrel()
|
||||||
|
.UseStartup<Startup>()
|
||||||
|
.UseContentRoot(Directory.GetCurrentDirectory())
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
host.Run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Home Page";
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>@ViewData["Title"] - ApplicationInsightsJavaScriptSnippetSample</title>
|
||||||
|
<script>document.write('Head tag script. Look for Application Insights JavaScriptSnippet below this script in the HTML file.')</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container body-content">
|
||||||
|
@RenderBody()
|
||||||
|
<hr />
|
||||||
|
<footer>
|
||||||
|
<p>© 2017 - ApplicationInsightsJavaScriptSnippetSample</p>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
@RenderSection("Scripts", required: false)
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
@using ApplicationInsightsJavaScriptSnippetSample
|
||||||
|
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
@{
|
||||||
|
Layout = "_Layout";
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"IncludeScopes": false,
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Debug",
|
||||||
|
"System": "Information",
|
||||||
|
"Microsoft": "Information"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
"ApplicationInsights": {
|
||||||
|
"InstrumentationKey": "11111111-2222-3333-4444-555555555555"
|
||||||
|
},
|
||||||
|
"Logging": {
|
||||||
|
"IncludeScopes": false,
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"System": "Warning",
|
||||||
|
"Microsoft": "Warning"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"Microsoft.ApplicationInsights.AspNetCore.Logging.ApplicationInsightsLoggerProvider": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Microsoft": "Information",
|
||||||
|
"Specific": "Trace",
|
||||||
|
"Application": "Trace"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFrameworks>netcoreapp2.1;net461</TargetFrameworks>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="$(MicrosoftAspNetCoreHostingPackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="$(MicrosoftAspNetCoreServerIISIntegrationPackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="$(MicrosoftAspNetCoreServerKestrelPackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(MicrosoftExtensionsLoggingConsolePackageVersion)" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.AzureAppServices.HostingStartup\Microsoft.AspNetCore.AzureAppServices.HostingStartup.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
@ -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.AzureAppServices.HostingStartup;Microsoft.AspNetCore.Server.IISIntegration"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"AzureAppServicesHostingStartupSample": {
|
||||||
|
"commandName": "IISExpress",
|
||||||
|
"launchBrowser": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,76 @@
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using Microsoft.AspNetCore.Builder;
|
||||||
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace IISSample
|
||||||
|
{
|
||||||
|
public class Startup
|
||||||
|
{
|
||||||
|
public void Configure(IApplicationBuilder app, ILoggerFactory loggerfactory)
|
||||||
|
{
|
||||||
|
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()
|
||||||
|
.ConfigureLogging(factory =>
|
||||||
|
{
|
||||||
|
factory.AddConsole();
|
||||||
|
})
|
||||||
|
.UseKestrel()
|
||||||
|
.UseStartup<Startup>()
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
host.Run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFrameworks>netcoreapp2.1;net461</TargetFrameworks>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.AzureAppServicesIntegration\Microsoft.AspNetCore.AzureAppServicesIntegration.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="$(MicrosoftAspNetCoreHostingPackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="$(MicrosoftAspNetCoreServerIISIntegrationPackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="$(MicrosoftAspNetCoreServerKestrelPackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(MicrosoftExtensionsLoggingConsolePackageVersion)" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
{
|
||||||
|
"iisSettings": {
|
||||||
|
"windowsAuthentication": false,
|
||||||
|
"anonymousAuthentication": true,
|
||||||
|
"iisExpress": {
|
||||||
|
"applicationUrl": "http://localhost:64358/",
|
||||||
|
"sslPort": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"profiles": {
|
||||||
|
"IIS Express": {
|
||||||
|
"commandName": "IISExpress",
|
||||||
|
"launchBrowser": true,
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||||
|
"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.Server.IISIntegration"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"AzureAppServicesSample": {
|
||||||
|
"commandName": "IISExpress",
|
||||||
|
"launchBrowser": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,89 @@
|
||||||
|
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<IISOptions>(options =>
|
||||||
|
{
|
||||||
|
});
|
||||||
|
services.Configure<ForwardedHeadersOptions>(options =>
|
||||||
|
{
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Configure(IApplicationBuilder app, ILoggerFactory loggerfactory)
|
||||||
|
{
|
||||||
|
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()
|
||||||
|
.ConfigureLogging(factory =>
|
||||||
|
{
|
||||||
|
factory.AddConsole();
|
||||||
|
})
|
||||||
|
.UseKestrel()
|
||||||
|
.UseAzureAppServices()
|
||||||
|
.UseStartup<Startup>()
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
host.Run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
<Project>
|
||||||
|
<Import Project="..\Directory.Build.props" />
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Internal.AspNetCore.Sdk" PrivateAssets="All" Version="$(InternalAspNetCoreSdkPackageVersion)" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
// 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.AspNetCore.Builder;
|
||||||
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace Microsoft.AspNetCore.ApplicationInsights.HostingStartup
|
||||||
|
{
|
||||||
|
internal class ApplicationInsightsLoggerStartupFilter : IStartupFilter
|
||||||
|
{
|
||||||
|
public Action<IApplicationBuilder> Configure(Action<IApplicationBuilder> next)
|
||||||
|
{
|
||||||
|
return builder =>
|
||||||
|
{
|
||||||
|
var loggerFactory = builder.ApplicationServices.GetService<ILoggerFactory>();
|
||||||
|
|
||||||
|
// We need to disable filtering on logger, filtering would be done by LoggerFactory
|
||||||
|
var loggerEnabled = true;
|
||||||
|
|
||||||
|
loggerFactory.AddApplicationInsights(
|
||||||
|
builder.ApplicationServices,
|
||||||
|
(s, level) => loggerEnabled,
|
||||||
|
() => loggerEnabled = false);
|
||||||
|
|
||||||
|
next(builder);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,58 @@
|
||||||
|
// 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 System.IO;
|
||||||
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
using Microsoft.AspNetCore.Razor.TagHelpers;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
[assembly: HostingStartup(typeof(Microsoft.AspNetCore.ApplicationInsights.HostingStartup.ApplicationInsightsHostingStartup))]
|
||||||
|
|
||||||
|
// To be able to build as <OutputType>Exe</OutputType>
|
||||||
|
internal class Program { public static void Main() { } }
|
||||||
|
|
||||||
|
namespace Microsoft.AspNetCore.ApplicationInsights.HostingStartup
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A dynamic Application Insights lightup experience
|
||||||
|
/// </summary>
|
||||||
|
public class ApplicationInsightsHostingStartup : IHostingStartup
|
||||||
|
{
|
||||||
|
private const string ApplicationInsightsSettingsFile = "ApplicationInsights.settings.json";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Calls UseApplicationInsights
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="builder"></param>
|
||||||
|
public void Configure(IWebHostBuilder builder)
|
||||||
|
{
|
||||||
|
builder.UseApplicationInsights();
|
||||||
|
|
||||||
|
builder.ConfigureServices(InitializeServices);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds the Javascript <see cref="TagHelperComponent"/> to the <see cref="IServiceCollection"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="services">The <see cref="IServiceCollection"/> associated with the application.</param>
|
||||||
|
private void InitializeServices(IServiceCollection services)
|
||||||
|
{
|
||||||
|
services.AddSingleton<IStartupFilter, ApplicationInsightsLoggerStartupFilter>();
|
||||||
|
services.AddSingleton<ITagHelperComponent, JavaScriptSnippetTagHelperComponent>();
|
||||||
|
|
||||||
|
var home = Environment.GetEnvironmentVariable("HOME");
|
||||||
|
if (!string.IsNullOrEmpty(home))
|
||||||
|
{
|
||||||
|
var settingsFile = Path.Combine(home, "site", "diagnostics", ApplicationInsightsSettingsFile);
|
||||||
|
var configurationBuilder = new ConfigurationBuilder()
|
||||||
|
.AddJsonFile(settingsFile, optional: true, reloadOnChange: true);
|
||||||
|
|
||||||
|
services.AddLogging(builder => builder.AddConfiguration(configurationBuilder.Build().GetSection("Logging")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
// 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.ApplicationInsights.AspNetCore;
|
||||||
|
using Microsoft.AspNetCore.Razor.TagHelpers;
|
||||||
|
|
||||||
|
namespace Microsoft.AspNetCore.ApplicationInsights.HostingStartup
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="TagHelperComponent"/> that injects the <see cref="JavaScriptSnippet"/> at the end of the head tag.
|
||||||
|
/// </summary>
|
||||||
|
public class JavaScriptSnippetTagHelperComponent : TagHelperComponent
|
||||||
|
{
|
||||||
|
private readonly string _javaScriptSnippet;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes the <see cref="JavaScriptSnippetTagHelperComponent"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="javaScriptSnippet">The <see cref="JavaScriptSnippet"/> to inject in the head tag.</param>
|
||||||
|
public JavaScriptSnippetTagHelperComponent(JavaScriptSnippet javaScriptSnippet)
|
||||||
|
{
|
||||||
|
_javaScriptSnippet = javaScriptSnippet.FullScript;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override int Order => 100;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Appends the <see cref="JavaScriptSnippet"/> to the head tag.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="context">The <see cref="TagHelperContext"/> associated with the head tag.</param>
|
||||||
|
/// <param name="output">The <see cref="TagHelperOutput"/> of the head tag.</param>
|
||||||
|
public override void Process(TagHelperContext context, TagHelperOutput output)
|
||||||
|
{
|
||||||
|
if (string.Equals(context.TagName, "head", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
output.PostContent.AppendHtml(_javaScriptSnippet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<Import Project="..\..\build\hostingstartup.targets" />
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<Description>ASP.NET Core lightup integration with Application Insights.</Description>
|
||||||
|
<TargetFrameworks>netcoreapp2.1;netcoreapp2.0;net461</TargetFrameworks>
|
||||||
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
|
<PackageTags>aspnetcore;ApplicationInsights;Analytics;Telemetry;AppInsights</PackageTags>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="$(MicrosoftApplicationInsightsAspNetCorePackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="$(MicrosoftAspNetCoreHostingPackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Razor.Runtime" Version="$(MicrosoftAspNetCoreRazorRuntimePackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="$(MicrosoftExtensionsConfigurationJsonPackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging" Version="$(MicrosoftExtensionsLoggingPackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging.Configuration" Version="$(MicrosoftExtensionsLoggingConfigurationPackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DiagnosticAdapter" Version="$(MicrosoftExtensionsDiagnosticAdapterPackageVersion)" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,91 @@
|
||||||
|
{
|
||||||
|
"AssemblyIdentity": "Microsoft.AspNetCore.ApplicationInsights.HostingStartup, Version=2.0.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
|
||||||
|
"Types": [
|
||||||
|
{
|
||||||
|
"Name": "Microsoft.AspNetCore.ApplicationInsights.HostingStartup.ApplicationInsightsHostingStartup",
|
||||||
|
"Visibility": "Public",
|
||||||
|
"Kind": "Class",
|
||||||
|
"ImplementedInterfaces": [
|
||||||
|
"Microsoft.AspNetCore.Hosting.IHostingStartup"
|
||||||
|
],
|
||||||
|
"Members": [
|
||||||
|
{
|
||||||
|
"Kind": "Method",
|
||||||
|
"Name": "Configure",
|
||||||
|
"Parameters": [
|
||||||
|
{
|
||||||
|
"Name": "builder",
|
||||||
|
"Type": "Microsoft.AspNetCore.Hosting.IWebHostBuilder"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ReturnType": "System.Void",
|
||||||
|
"Sealed": true,
|
||||||
|
"Virtual": true,
|
||||||
|
"ImplementedInterface": "Microsoft.AspNetCore.Hosting.IHostingStartup",
|
||||||
|
"Visibility": "Public",
|
||||||
|
"GenericParameter": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Kind": "Constructor",
|
||||||
|
"Name": ".ctor",
|
||||||
|
"Parameters": [],
|
||||||
|
"Visibility": "Public",
|
||||||
|
"GenericParameter": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"GenericParameters": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "Microsoft.AspNetCore.ApplicationInsights.HostingStartup.JavaScriptSnippetTagHelperComponent",
|
||||||
|
"Visibility": "Public",
|
||||||
|
"Kind": "Class",
|
||||||
|
"BaseType": "Microsoft.AspNetCore.Razor.TagHelpers.TagHelperComponent",
|
||||||
|
"ImplementedInterfaces": [],
|
||||||
|
"Members": [
|
||||||
|
{
|
||||||
|
"Kind": "Method",
|
||||||
|
"Name": "get_Order",
|
||||||
|
"Parameters": [],
|
||||||
|
"ReturnType": "System.Int32",
|
||||||
|
"Virtual": true,
|
||||||
|
"Override": true,
|
||||||
|
"ImplementedInterface": "Microsoft.AspNetCore.Razor.TagHelpers.ITagHelperComponent",
|
||||||
|
"Visibility": "Public",
|
||||||
|
"GenericParameter": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Kind": "Method",
|
||||||
|
"Name": "Process",
|
||||||
|
"Parameters": [
|
||||||
|
{
|
||||||
|
"Name": "context",
|
||||||
|
"Type": "Microsoft.AspNetCore.Razor.TagHelpers.TagHelperContext"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "output",
|
||||||
|
"Type": "Microsoft.AspNetCore.Razor.TagHelpers.TagHelperOutput"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ReturnType": "System.Void",
|
||||||
|
"Virtual": true,
|
||||||
|
"Override": true,
|
||||||
|
"Visibility": "Public",
|
||||||
|
"GenericParameter": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Kind": "Constructor",
|
||||||
|
"Name": ".ctor",
|
||||||
|
"Parameters": [
|
||||||
|
{
|
||||||
|
"Name": "javaScriptSnippet",
|
||||||
|
"Type": "Microsoft.ApplicationInsights.AspNetCore.JavaScriptSnippet"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Visibility": "Public",
|
||||||
|
"GenericParameter": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"GenericParameters": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,91 @@
|
||||||
|
{
|
||||||
|
"AssemblyIdentity": "Microsoft.AspNetCore.ApplicationInsights.HostingStartup, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
|
||||||
|
"Types": [
|
||||||
|
{
|
||||||
|
"Name": "Microsoft.AspNetCore.ApplicationInsights.HostingStartup.ApplicationInsightsHostingStartup",
|
||||||
|
"Visibility": "Public",
|
||||||
|
"Kind": "Class",
|
||||||
|
"ImplementedInterfaces": [
|
||||||
|
"Microsoft.AspNetCore.Hosting.IHostingStartup"
|
||||||
|
],
|
||||||
|
"Members": [
|
||||||
|
{
|
||||||
|
"Kind": "Method",
|
||||||
|
"Name": "Configure",
|
||||||
|
"Parameters": [
|
||||||
|
{
|
||||||
|
"Name": "builder",
|
||||||
|
"Type": "Microsoft.AspNetCore.Hosting.IWebHostBuilder"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ReturnType": "System.Void",
|
||||||
|
"Sealed": true,
|
||||||
|
"Virtual": true,
|
||||||
|
"ImplementedInterface": "Microsoft.AspNetCore.Hosting.IHostingStartup",
|
||||||
|
"Visibility": "Public",
|
||||||
|
"GenericParameter": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Kind": "Constructor",
|
||||||
|
"Name": ".ctor",
|
||||||
|
"Parameters": [],
|
||||||
|
"Visibility": "Public",
|
||||||
|
"GenericParameter": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"GenericParameters": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "Microsoft.AspNetCore.ApplicationInsights.HostingStartup.JavaScriptSnippetTagHelperComponent",
|
||||||
|
"Visibility": "Public",
|
||||||
|
"Kind": "Class",
|
||||||
|
"BaseType": "Microsoft.AspNetCore.Razor.TagHelpers.TagHelperComponent",
|
||||||
|
"ImplementedInterfaces": [],
|
||||||
|
"Members": [
|
||||||
|
{
|
||||||
|
"Kind": "Method",
|
||||||
|
"Name": "get_Order",
|
||||||
|
"Parameters": [],
|
||||||
|
"ReturnType": "System.Int32",
|
||||||
|
"Virtual": true,
|
||||||
|
"Override": true,
|
||||||
|
"ImplementedInterface": "Microsoft.AspNetCore.Razor.TagHelpers.ITagHelperComponent",
|
||||||
|
"Visibility": "Public",
|
||||||
|
"GenericParameter": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Kind": "Method",
|
||||||
|
"Name": "Process",
|
||||||
|
"Parameters": [
|
||||||
|
{
|
||||||
|
"Name": "context",
|
||||||
|
"Type": "Microsoft.AspNetCore.Razor.TagHelpers.TagHelperContext"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "output",
|
||||||
|
"Type": "Microsoft.AspNetCore.Razor.TagHelpers.TagHelperOutput"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ReturnType": "System.Void",
|
||||||
|
"Virtual": true,
|
||||||
|
"Override": true,
|
||||||
|
"Visibility": "Public",
|
||||||
|
"GenericParameter": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Kind": "Constructor",
|
||||||
|
"Name": ".ctor",
|
||||||
|
"Parameters": [
|
||||||
|
{
|
||||||
|
"Name": "javaScriptSnippet",
|
||||||
|
"Type": "Microsoft.ApplicationInsights.AspNetCore.JavaScriptSnippet"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Visibility": "Public",
|
||||||
|
"GenericParameter": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"GenericParameters": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
// 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.Runtime.CompilerServices;
|
||||||
|
|
||||||
|
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.AzureAppServicesIntegration.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
// 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.AzureAppServices.HostingStartup.AzureAppServicesHostingStartup))]
|
||||||
|
|
||||||
|
namespace Microsoft.AspNetCore.AzureAppServices.HostingStartup
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A dynamic azure lightup experiance
|
||||||
|
/// </summary>
|
||||||
|
public class AzureAppServicesHostingStartup : IHostingStartup
|
||||||
|
{
|
||||||
|
private const string HostingStartupName = "AppServices";
|
||||||
|
private const string DiagnosticsFeatureName = "DiagnosticsEnabled";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Calls UseAzureAppServices
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="builder"></param>
|
||||||
|
public void Configure(IWebHostBuilder builder)
|
||||||
|
{
|
||||||
|
var baseConfiguration = HostingStartupConfigurationExtensions.GetBaseConfiguration();
|
||||||
|
|
||||||
|
if (baseConfiguration.IsEnabled(HostingStartupName, DiagnosticsFeatureName))
|
||||||
|
{
|
||||||
|
builder.UseAzureAppServices();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
// 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.Extensions.Configuration;
|
||||||
|
|
||||||
|
namespace Microsoft.AspNetCore.Hosting
|
||||||
|
{
|
||||||
|
internal static class HostingStartupConfigurationExtensions
|
||||||
|
{
|
||||||
|
public static IConfiguration GetBaseConfiguration()
|
||||||
|
{
|
||||||
|
return new ConfigurationBuilder()
|
||||||
|
.AddEnvironmentVariables(prefix: "ASPNETCORE_")
|
||||||
|
.Build();
|
||||||
|
}
|
||||||
|
public static bool IsEnabled(this IConfiguration configuration, string hostingStartupName, string featureName)
|
||||||
|
{
|
||||||
|
if (configuration.TryGetOption(hostingStartupName, featureName, out var value))
|
||||||
|
{
|
||||||
|
value = value.ToLowerInvariant();
|
||||||
|
return value != "false" && value != "0";
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool TryGetOption(this IConfiguration configuration, string hostingStartupName, string featureName, out string value)
|
||||||
|
{
|
||||||
|
value = configuration[$"HostingStartup:{hostingStartupName}:{featureName}"];
|
||||||
|
return !string.IsNullOrEmpty(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<Import Project="..\..\build\hostingstartup.targets" />
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<Description>ASP.NET Core lightup integration with Azure AppServices.</Description>
|
||||||
|
<TargetFrameworks>netcoreapp2.1;netcoreapp2.0;net461</TargetFrameworks>
|
||||||
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
|
<PackageTags>aspnetcore;azure;appservices</PackageTags>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Microsoft.AspNetCore.AzureAppServicesIntegration\Microsoft.AspNetCore.AzureAppServicesIntegration.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="$(MicrosoftExtensionsConfigurationEnvironmentVariablesPackageVersion)" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
{
|
||||||
|
"AssemblyIdentity": "Microsoft.AspNetCore.AzureAppServices.HostingStartup, Version=2.0.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
|
||||||
|
"Types": [
|
||||||
|
{
|
||||||
|
"Name": "Microsoft.AspNetCore.AzureAppServices.HostingStartup.AzureAppServicesHostingStartup",
|
||||||
|
"Visibility": "Public",
|
||||||
|
"Kind": "Class",
|
||||||
|
"ImplementedInterfaces": [
|
||||||
|
"Microsoft.AspNetCore.Hosting.IHostingStartup"
|
||||||
|
],
|
||||||
|
"Members": [
|
||||||
|
{
|
||||||
|
"Kind": "Method",
|
||||||
|
"Name": "Configure",
|
||||||
|
"Parameters": [
|
||||||
|
{
|
||||||
|
"Name": "builder",
|
||||||
|
"Type": "Microsoft.AspNetCore.Hosting.IWebHostBuilder"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ReturnType": "System.Void",
|
||||||
|
"Sealed": true,
|
||||||
|
"Virtual": true,
|
||||||
|
"ImplementedInterface": "Microsoft.AspNetCore.Hosting.IHostingStartup",
|
||||||
|
"Visibility": "Public",
|
||||||
|
"GenericParameter": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Kind": "Constructor",
|
||||||
|
"Name": ".ctor",
|
||||||
|
"Parameters": [],
|
||||||
|
"Visibility": "Public",
|
||||||
|
"GenericParameter": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"GenericParameters": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
{
|
||||||
|
"AssemblyIdentity": "Microsoft.AspNetCore.AzureAppServices.HostingStartup, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
|
||||||
|
"Types": [
|
||||||
|
{
|
||||||
|
"Name": "Microsoft.AspNetCore.AzureAppServices.HostingStartup.AzureAppServicesHostingStartup",
|
||||||
|
"Visibility": "Public",
|
||||||
|
"Kind": "Class",
|
||||||
|
"ImplementedInterfaces": [
|
||||||
|
"Microsoft.AspNetCore.Hosting.IHostingStartup"
|
||||||
|
],
|
||||||
|
"Members": [
|
||||||
|
{
|
||||||
|
"Kind": "Method",
|
||||||
|
"Name": "Configure",
|
||||||
|
"Parameters": [
|
||||||
|
{
|
||||||
|
"Name": "builder",
|
||||||
|
"Type": "Microsoft.AspNetCore.Hosting.IWebHostBuilder"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ReturnType": "System.Void",
|
||||||
|
"Sealed": true,
|
||||||
|
"Virtual": true,
|
||||||
|
"ImplementedInterface": "Microsoft.AspNetCore.Hosting.IHostingStartup",
|
||||||
|
"Visibility": "Public",
|
||||||
|
"GenericParameter": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Kind": "Constructor",
|
||||||
|
"Name": ".ctor",
|
||||||
|
"Parameters": [],
|
||||||
|
"Visibility": "Public",
|
||||||
|
"GenericParameter": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"GenericParameters": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
// 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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Configures application to use Azure AppServices integration.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="hostBuilder"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static IWebHostBuilder UseAzureAppServices(this IWebHostBuilder hostBuilder)
|
||||||
|
{
|
||||||
|
if (hostBuilder == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(hostBuilder));
|
||||||
|
}
|
||||||
|
#pragma warning disable 618
|
||||||
|
hostBuilder.ConfigureLogging(builder => builder.AddAzureWebAppDiagnostics());
|
||||||
|
#pragma warning restore 618
|
||||||
|
return hostBuilder;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<Description>ASP.NET Core integration with Azure AppServices.</Description>
|
||||||
|
<TargetFramework>netstandard2.0</TargetFramework>
|
||||||
|
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
|
<PackageTags>aspnetcore;azure;appservices</PackageTags>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="$(MicrosoftAspNetCoreHostingPackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="$(MicrosoftExtensionsLoggingAzureAppServicesPackageVersion)" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
// 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.Runtime.CompilerServices;
|
||||||
|
|
||||||
|
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Hosting.Azure.AppServices.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
{
|
||||||
|
"AssemblyIdentity": "Microsoft.AspNetCore.AzureAppServicesIntegration, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
|
||||||
|
"Types": [
|
||||||
|
{
|
||||||
|
"Name": "Microsoft.AspNetCore.Hosting.AppServicesWebHostBuilderExtensions",
|
||||||
|
"Visibility": "Public",
|
||||||
|
"Kind": "Class",
|
||||||
|
"Abstract": true,
|
||||||
|
"Static": true,
|
||||||
|
"Sealed": true,
|
||||||
|
"ImplementedInterfaces": [],
|
||||||
|
"Members": [
|
||||||
|
{
|
||||||
|
"Kind": "Method",
|
||||||
|
"Name": "UseAzureAppServices",
|
||||||
|
"Parameters": [
|
||||||
|
{
|
||||||
|
"Name": "hostBuilder",
|
||||||
|
"Type": "Microsoft.AspNetCore.Hosting.IWebHostBuilder"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ReturnType": "Microsoft.AspNetCore.Hosting.IWebHostBuilder",
|
||||||
|
"Static": true,
|
||||||
|
"Extension": true,
|
||||||
|
"Visibility": "Public",
|
||||||
|
"GenericParameter": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"GenericParameters": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
// 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.
|
||||||
|
|
||||||
|
namespace Microsoft.Extensions.ApplicationModelDetection
|
||||||
|
{
|
||||||
|
public class AppModelDetectionResult
|
||||||
|
{
|
||||||
|
public RuntimeFramework? Framework { get; set; }
|
||||||
|
public string FrameworkVersion { get; set; }
|
||||||
|
public string AspNetCoreVersion { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,250 @@
|
||||||
|
// 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 System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection.Metadata;
|
||||||
|
using System.Reflection.PortableExecutable;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
|
namespace Microsoft.Extensions.ApplicationModelDetection
|
||||||
|
{
|
||||||
|
public class AppModelDetector
|
||||||
|
{
|
||||||
|
// We use Hosting package to detect AspNetCore version
|
||||||
|
// it contains light-up implemenation that we care about and
|
||||||
|
// would have to be used by aspnet core web apps
|
||||||
|
private const string AspNetCoreAssembly = "Microsoft.AspNetCore.Hosting";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reads the following sources
|
||||||
|
/// - web.config to detect dotnet framework kind
|
||||||
|
/// - *.runtimeconfig.json to detect target framework version
|
||||||
|
/// - *.deps.json to detect Asp.Net Core version
|
||||||
|
/// - Microsoft.AspNetCore.Hosting.dll to detect Asp.Net Core version
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="directory">The application directory</param>
|
||||||
|
/// <returns>The <see cref="AppModelDetectionResult"/> instance containing information about application</returns>
|
||||||
|
public AppModelDetectionResult Detect(DirectoryInfo directory)
|
||||||
|
{
|
||||||
|
string entryPoint = null;
|
||||||
|
|
||||||
|
// Try reading web.config and resolving framework and app path
|
||||||
|
var webConfig = directory.GetFiles("web.config").FirstOrDefault();
|
||||||
|
|
||||||
|
bool webConfigExists = webConfig != null;
|
||||||
|
bool? usesDotnetExe = null;
|
||||||
|
|
||||||
|
if (webConfigExists &&
|
||||||
|
TryParseWebConfig(webConfig, out var dotnetExe, out entryPoint))
|
||||||
|
{
|
||||||
|
usesDotnetExe = dotnetExe;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we found entry point let's look for .deps.json
|
||||||
|
// in some cases it exists in desktop too
|
||||||
|
FileInfo depsJson = null;
|
||||||
|
FileInfo runtimeConfig = null;
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(entryPoint))
|
||||||
|
{
|
||||||
|
depsJson = new FileInfo(Path.ChangeExtension(entryPoint, ".deps.json"));
|
||||||
|
runtimeConfig = new FileInfo(Path.ChangeExtension(entryPoint, ".runtimeconfig.json"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (depsJson == null || !depsJson.Exists)
|
||||||
|
{
|
||||||
|
depsJson = directory.GetFiles("*.deps.json").FirstOrDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (runtimeConfig == null || !runtimeConfig.Exists)
|
||||||
|
{
|
||||||
|
runtimeConfig = directory.GetFiles("*.runtimeconfig.json").FirstOrDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
string aspNetCoreVersionFromDeps = null;
|
||||||
|
string aspNetCoreVersionFromDll = null;
|
||||||
|
|
||||||
|
|
||||||
|
// Try to detect ASP.NET Core version from .deps.json
|
||||||
|
if (depsJson != null &&
|
||||||
|
depsJson.Exists &&
|
||||||
|
TryParseDependencies(depsJson, out var aspNetCoreVersion))
|
||||||
|
{
|
||||||
|
aspNetCoreVersionFromDeps = aspNetCoreVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try to detect ASP.NET Core version from .deps.json
|
||||||
|
var aspNetCoreDll = directory.GetFiles(AspNetCoreAssembly + ".dll").FirstOrDefault();
|
||||||
|
if (aspNetCoreDll != null &&
|
||||||
|
TryParseAssembly(aspNetCoreDll, out aspNetCoreVersion))
|
||||||
|
{
|
||||||
|
aspNetCoreVersionFromDll = aspNetCoreVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try to detect dotnet core runtime version from runtimeconfig.json
|
||||||
|
string runtimeVersionFromRuntimeConfig = null;
|
||||||
|
if (runtimeConfig != null &&
|
||||||
|
runtimeConfig.Exists)
|
||||||
|
{
|
||||||
|
TryParseRuntimeConfig(runtimeConfig, out runtimeVersionFromRuntimeConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = new AppModelDetectionResult();
|
||||||
|
if (usesDotnetExe == true)
|
||||||
|
{
|
||||||
|
result.Framework = RuntimeFramework.DotNetCore;
|
||||||
|
result.FrameworkVersion = runtimeVersionFromRuntimeConfig;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (depsJson?.Exists == true &&
|
||||||
|
runtimeConfig?.Exists == true)
|
||||||
|
{
|
||||||
|
result.Framework = RuntimeFramework.DotNetCoreStandalone;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result.Framework = RuntimeFramework.DotNetFramework;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
result.AspNetCoreVersion = aspNetCoreVersionFromDeps ?? aspNetCoreVersionFromDll;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool TryParseAssembly(FileInfo aspNetCoreDll, out string aspNetCoreVersion)
|
||||||
|
{
|
||||||
|
aspNetCoreVersion = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (var stream = aspNetCoreDll.OpenRead())
|
||||||
|
using (var peReader = new PEReader(stream))
|
||||||
|
{
|
||||||
|
var metadataReader = peReader.GetMetadataReader();
|
||||||
|
var assemblyDefinition = metadataReader.GetAssemblyDefinition();
|
||||||
|
aspNetCoreVersion = assemblyDefinition.Version.ToString();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Search for Microsoft.AspNetCore.Hosting entry in deps.json and get it's version number
|
||||||
|
/// </summary>
|
||||||
|
private bool TryParseDependencies(FileInfo depsJson, out string aspnetCoreVersion)
|
||||||
|
{
|
||||||
|
aspnetCoreVersion = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (var streamReader = depsJson.OpenText())
|
||||||
|
using (var jsonReader = new JsonTextReader(streamReader))
|
||||||
|
{
|
||||||
|
var json = JObject.Load(jsonReader);
|
||||||
|
|
||||||
|
var libraryPrefix = AspNetCoreAssembly+ "/";
|
||||||
|
|
||||||
|
var library = json.Descendants().OfType<JProperty>().FirstOrDefault(property => property.Name.StartsWith(libraryPrefix));
|
||||||
|
if (library != null)
|
||||||
|
{
|
||||||
|
aspnetCoreVersion = library.Name.Substring(libraryPrefix.Length);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool TryParseRuntimeConfig(FileInfo runtimeConfig, out string frameworkVersion)
|
||||||
|
{
|
||||||
|
frameworkVersion = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (var streamReader = runtimeConfig.OpenText())
|
||||||
|
using (var jsonReader = new JsonTextReader(streamReader))
|
||||||
|
{
|
||||||
|
var json = JObject.Load(jsonReader);
|
||||||
|
frameworkVersion = (string)json?["runtimeOptions"]
|
||||||
|
?["framework"]
|
||||||
|
?["version"];
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool TryParseWebConfig(FileInfo webConfig, out bool usesDotnetExe, out string entryPoint)
|
||||||
|
{
|
||||||
|
usesDotnetExe = false;
|
||||||
|
entryPoint = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var xdocument = XDocument.Load(webConfig.FullName);
|
||||||
|
var aspNetCoreHandler = xdocument.Root?
|
||||||
|
.Element("system.webServer")
|
||||||
|
.Element("aspNetCore");
|
||||||
|
|
||||||
|
if (aspNetCoreHandler == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var processPath = (string) aspNetCoreHandler.Attribute("processPath");
|
||||||
|
var arguments = (string) aspNetCoreHandler.Attribute("arguments");
|
||||||
|
|
||||||
|
if (processPath.EndsWith("dotnet", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
processPath.EndsWith("dotnet.exe", StringComparison.OrdinalIgnoreCase) &&
|
||||||
|
!string.IsNullOrWhiteSpace(arguments))
|
||||||
|
{
|
||||||
|
usesDotnetExe = true;
|
||||||
|
var entryPointPart = arguments.Split(new[] {" "}, StringSplitOptions.RemoveEmptyEntries).FirstOrDefault();
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(entryPointPart))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
entryPoint = Path.GetFullPath(Path.Combine(webConfig.DirectoryName, entryPointPart));
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
usesDotnetExe = false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
entryPoint = Path.GetFullPath(Path.Combine(webConfig.DirectoryName, processPath));
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
<PropertyGroup>
|
||||||
|
<Description>ASP.NET Core integration with Azure AppServices.</Description>
|
||||||
|
<TargetFramework>netstandard2.0</TargetFramework>
|
||||||
|
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
|
<PackageTags>aspnetcore;azure;appservices</PackageTags>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="$(MicrosoftAspNetCoreHostingPackageVersion)" />
|
||||||
|
<PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonPackageVersion)" />
|
||||||
|
<PackageReference Include="System.Reflection.Metadata" Version="$(SystemReflectionMetadataPackageVersion)" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
// 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.
|
||||||
|
|
||||||
|
namespace Microsoft.Extensions.ApplicationModelDetection
|
||||||
|
{
|
||||||
|
public enum RuntimeFramework
|
||||||
|
{
|
||||||
|
DotNetCore,
|
||||||
|
DotNetCoreStandalone,
|
||||||
|
DotNetFramework
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,144 @@
|
||||||
|
{
|
||||||
|
"AssemblyIdentity": "Microsoft.Extensions.ApplicationModelDetection, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
|
||||||
|
"Types": [
|
||||||
|
{
|
||||||
|
"Name": "Microsoft.Extensions.ApplicationModelDetection.AppModelDetectionResult",
|
||||||
|
"Visibility": "Public",
|
||||||
|
"Kind": "Class",
|
||||||
|
"ImplementedInterfaces": [],
|
||||||
|
"Members": [
|
||||||
|
{
|
||||||
|
"Kind": "Method",
|
||||||
|
"Name": "get_Framework",
|
||||||
|
"Parameters": [],
|
||||||
|
"ReturnType": "System.Nullable<Microsoft.Extensions.ApplicationModelDetection.RuntimeFramework>",
|
||||||
|
"Visibility": "Public",
|
||||||
|
"GenericParameter": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Kind": "Method",
|
||||||
|
"Name": "set_Framework",
|
||||||
|
"Parameters": [
|
||||||
|
{
|
||||||
|
"Name": "value",
|
||||||
|
"Type": "System.Nullable<Microsoft.Extensions.ApplicationModelDetection.RuntimeFramework>"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ReturnType": "System.Void",
|
||||||
|
"Visibility": "Public",
|
||||||
|
"GenericParameter": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Kind": "Method",
|
||||||
|
"Name": "get_FrameworkVersion",
|
||||||
|
"Parameters": [],
|
||||||
|
"ReturnType": "System.String",
|
||||||
|
"Visibility": "Public",
|
||||||
|
"GenericParameter": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Kind": "Method",
|
||||||
|
"Name": "set_FrameworkVersion",
|
||||||
|
"Parameters": [
|
||||||
|
{
|
||||||
|
"Name": "value",
|
||||||
|
"Type": "System.String"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ReturnType": "System.Void",
|
||||||
|
"Visibility": "Public",
|
||||||
|
"GenericParameter": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Kind": "Method",
|
||||||
|
"Name": "get_AspNetCoreVersion",
|
||||||
|
"Parameters": [],
|
||||||
|
"ReturnType": "System.String",
|
||||||
|
"Visibility": "Public",
|
||||||
|
"GenericParameter": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Kind": "Method",
|
||||||
|
"Name": "set_AspNetCoreVersion",
|
||||||
|
"Parameters": [
|
||||||
|
{
|
||||||
|
"Name": "value",
|
||||||
|
"Type": "System.String"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ReturnType": "System.Void",
|
||||||
|
"Visibility": "Public",
|
||||||
|
"GenericParameter": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Kind": "Constructor",
|
||||||
|
"Name": ".ctor",
|
||||||
|
"Parameters": [],
|
||||||
|
"Visibility": "Public",
|
||||||
|
"GenericParameter": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"GenericParameters": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "Microsoft.Extensions.ApplicationModelDetection.AppModelDetector",
|
||||||
|
"Visibility": "Public",
|
||||||
|
"Kind": "Class",
|
||||||
|
"ImplementedInterfaces": [],
|
||||||
|
"Members": [
|
||||||
|
{
|
||||||
|
"Kind": "Method",
|
||||||
|
"Name": "Detect",
|
||||||
|
"Parameters": [
|
||||||
|
{
|
||||||
|
"Name": "directory",
|
||||||
|
"Type": "System.IO.DirectoryInfo"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ReturnType": "Microsoft.Extensions.ApplicationModelDetection.AppModelDetectionResult",
|
||||||
|
"Visibility": "Public",
|
||||||
|
"GenericParameter": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Kind": "Constructor",
|
||||||
|
"Name": ".ctor",
|
||||||
|
"Parameters": [],
|
||||||
|
"Visibility": "Public",
|
||||||
|
"GenericParameter": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"GenericParameters": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "Microsoft.Extensions.ApplicationModelDetection.RuntimeFramework",
|
||||||
|
"Visibility": "Public",
|
||||||
|
"Kind": "Enumeration",
|
||||||
|
"Sealed": true,
|
||||||
|
"ImplementedInterfaces": [],
|
||||||
|
"Members": [
|
||||||
|
{
|
||||||
|
"Kind": "Field",
|
||||||
|
"Name": "DotNetCore",
|
||||||
|
"Parameters": [],
|
||||||
|
"GenericParameter": [],
|
||||||
|
"Literal": "0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Kind": "Field",
|
||||||
|
"Name": "DotNetCoreStandalone",
|
||||||
|
"Parameters": [],
|
||||||
|
"GenericParameter": [],
|
||||||
|
"Literal": "1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Kind": "Field",
|
||||||
|
"Name": "DotNetFramework",
|
||||||
|
"Parameters": [],
|
||||||
|
"GenericParameter": [],
|
||||||
|
"Literal": "2"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"GenericParameters": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,144 @@
|
||||||
|
// 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 System.Xml;
|
||||||
|
using Microsoft.Web.XmlTransform;
|
||||||
|
|
||||||
|
namespace Microsoft.Web.Xdt.Extensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Insert or append to the given attribute
|
||||||
|
/// </summary>
|
||||||
|
public class InsertOrAppendAttribute : Transform
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public InsertOrAppendAttribute()
|
||||||
|
: base(TransformFlags.UseParentAsTargetNode, MissingTargetMessage.Error)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _attributeName;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
protected string AttributeName
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_attributeName == null)
|
||||||
|
{
|
||||||
|
_attributeName = GetArgumentValue("Attribute");
|
||||||
|
}
|
||||||
|
return _attributeName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Extracts a value from the arguments provided
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
protected string GetArgumentValue(string name)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(name))
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
string result = null;
|
||||||
|
if (Arguments != null && Arguments.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (var arg in Arguments)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(arg))
|
||||||
|
{
|
||||||
|
var trimmedArg = arg.Trim();
|
||||||
|
if (trimmedArg.StartsWith(name, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
var start = arg.IndexOf('\'');
|
||||||
|
var last = arg.LastIndexOf('\'');
|
||||||
|
if (start <= 0 || last <= 0 || last <= start)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("Expected two ['] characters");
|
||||||
|
}
|
||||||
|
|
||||||
|
var value = trimmedArg.Substring(start, last - start);
|
||||||
|
|
||||||
|
// remove any leading or trailing '
|
||||||
|
value = value.Trim().TrimStart('\'').TrimStart('\'');
|
||||||
|
result = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
protected override void Apply()
|
||||||
|
{
|
||||||
|
if (TargetChildNodes == null || TargetChildNodes.Count == 0)
|
||||||
|
{
|
||||||
|
TargetNode.AppendChild(TransformNode);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
XmlAttribute transformAtt = null;
|
||||||
|
|
||||||
|
foreach (XmlAttribute att in TransformNode.Attributes)
|
||||||
|
{
|
||||||
|
if (string.Equals(att.Name, AttributeName, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
transformAtt = att;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (transformAtt == null)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException("No target attribute to append");
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (XmlNode targetNode in TargetChildNodes)
|
||||||
|
{
|
||||||
|
var foundAttribute = false;
|
||||||
|
foreach (XmlAttribute att in targetNode.Attributes)
|
||||||
|
{
|
||||||
|
if (string.Equals(att.Name, AttributeName, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
foundAttribute = true;
|
||||||
|
if (string.IsNullOrEmpty(att.Value))
|
||||||
|
{
|
||||||
|
att.Value = transformAtt.Value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// TODO: This doesn't compose well with insertOrAppend being applied on the TargetNode.
|
||||||
|
// The target node is created with the children it has in the transform, which means we would
|
||||||
|
// duplicate the value here.
|
||||||
|
if (att.Value == transformAtt.Value)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
att.Value = $"{att.Value};{transformAtt.Value}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!foundAttribute)
|
||||||
|
{
|
||||||
|
var attribute = targetNode.OwnerDocument.CreateAttribute(AttributeName);
|
||||||
|
attribute.Value = transformAtt.Value;
|
||||||
|
targetNode.Attributes.Append(attribute);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<Description>Additional functionality for Xdt transforms.</Description>
|
||||||
|
<TargetFramework>net461</TargetFramework>
|
||||||
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
|
<PackageTags>xdt</PackageTags>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Web.Xdt" Version="$(MicrosoftWebXdtPackageVersion)" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
{
|
||||||
|
"AssemblyIdentity": "Microsoft.Web.Xdt.Extensions, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
|
||||||
|
"Types": [
|
||||||
|
{
|
||||||
|
"Name": "Microsoft.Web.Xdt.Extensions.InsertOrAppendAttribute",
|
||||||
|
"Visibility": "Public",
|
||||||
|
"Kind": "Class",
|
||||||
|
"BaseType": "Microsoft.Web.XmlTransform.Transform",
|
||||||
|
"ImplementedInterfaces": [],
|
||||||
|
"Members": [
|
||||||
|
{
|
||||||
|
"Kind": "Method",
|
||||||
|
"Name": "get_AttributeName",
|
||||||
|
"Parameters": [],
|
||||||
|
"ReturnType": "System.String",
|
||||||
|
"Visibility": "Protected",
|
||||||
|
"GenericParameter": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Kind": "Method",
|
||||||
|
"Name": "GetArgumentValue",
|
||||||
|
"Parameters": [
|
||||||
|
{
|
||||||
|
"Name": "name",
|
||||||
|
"Type": "System.String"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ReturnType": "System.String",
|
||||||
|
"Visibility": "Protected",
|
||||||
|
"GenericParameter": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Kind": "Method",
|
||||||
|
"Name": "Apply",
|
||||||
|
"Parameters": [],
|
||||||
|
"ReturnType": "System.Void",
|
||||||
|
"Virtual": true,
|
||||||
|
"Override": true,
|
||||||
|
"Visibility": "Protected",
|
||||||
|
"GenericParameter": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Kind": "Constructor",
|
||||||
|
"Name": ".ctor",
|
||||||
|
"Parameters": [],
|
||||||
|
"Visibility": "Public",
|
||||||
|
"GenericParameter": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"GenericParameters": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container body-content">
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
<footer>
|
||||||
|
<p>© 2017 - ApplicationInsightsJavaScriptSnippetSample</p>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Remove="AfterScript.html" />
|
||||||
|
<None Remove="BeforeScript.html" />
|
||||||
|
<None Remove="Rendered.html" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="AfterScript.html" />
|
||||||
|
<EmbeddedResource Include="BeforeScript.html" />
|
||||||
|
<EmbeddedResource Include="Rendered.html" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.ApplicationInsights.HostingStartup\Microsoft.AspNetCore.ApplicationInsights.HostingStartup.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Server.IntegrationTesting" Version="$(MicrosoftAspNetCoreServerIntegrationTestingPackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(MicrosoftExtensionsLoggingConsolePackageVersion)" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Home Page - ApplicationInsightsJavaScriptSnippetSample</title>
|
||||||
|
<script>document.write('Head tag script. Look for Application Insights JavaScriptSnippet below this script in the HTML file.')</script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
|
@ -0,0 +1,66 @@
|
||||||
|
// 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 System.IO;
|
||||||
|
using Microsoft.Extensions.Logging.Testing;
|
||||||
|
using Xunit.Abstractions;
|
||||||
|
|
||||||
|
namespace ApplicationInsightsJavaScriptSnippetTest
|
||||||
|
{
|
||||||
|
public class ApplicationInsightsFunctionalTest : LoggedTest
|
||||||
|
{
|
||||||
|
public ApplicationInsightsFunctionalTest(ITestOutputHelper output) : base(output)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static string GetApplicationPath()
|
||||||
|
{
|
||||||
|
var current = new DirectoryInfo(AppContext.BaseDirectory);
|
||||||
|
while (current != null)
|
||||||
|
{
|
||||||
|
if (File.Exists(Path.Combine(current.FullName, "AzureIntegration.sln")))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
current = current.Parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (current == null)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException("Could not find the solution directory");
|
||||||
|
}
|
||||||
|
|
||||||
|
return Path.GetFullPath(Path.Combine(current.FullName, "sample", "ApplicationInsightsHostingStartupSample"));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static bool PreservePublishedApplicationForDebugging
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var deletePublishedFolder = Environment.GetEnvironmentVariable("ASPNETCORE_DELETEPUBLISHEDFOLDER");
|
||||||
|
|
||||||
|
if (string.Equals("false", deletePublishedFolder, StringComparison.OrdinalIgnoreCase)
|
||||||
|
|| string.Equals("0", deletePublishedFolder, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
// preserve the published folder and do not delete it
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// do not preserve the published folder and delete it
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static string GetCurrentBuildConfiguration()
|
||||||
|
{
|
||||||
|
var configuration = "Debug";
|
||||||
|
if (string.Equals(Environment.GetEnvironmentVariable("Configuration"), "Release", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
configuration = "Release";
|
||||||
|
}
|
||||||
|
|
||||||
|
return configuration;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,85 @@
|
||||||
|
// 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.Collections.Generic;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Server.IntegrationTesting;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Xunit;
|
||||||
|
using Xunit.Abstractions;
|
||||||
|
|
||||||
|
namespace ApplicationInsightsJavaScriptSnippetTest
|
||||||
|
{
|
||||||
|
public class JavaScriptSnippetTest : ApplicationInsightsFunctionalTest
|
||||||
|
{
|
||||||
|
public JavaScriptSnippetTest(ITestOutputHelper output) : base(output)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact(Skip="https://github.com/aspnet/AzureIntegration/issues/171")]
|
||||||
|
public Task ScriptIsInjected_ForNetCoreApp20_Standalone() => JavaScriptSnippetInjectionTestSuite("netcoreapp2.0", ApplicationType.Standalone);
|
||||||
|
|
||||||
|
[Fact(Skip="https://github.com/aspnet/AzureIntegration/issues/171")]
|
||||||
|
public Task ScriptIsInjected_ForNetCoreApp20_Portable() => JavaScriptSnippetInjectionTestSuite("netcoreapp2.0", ApplicationType.Portable);
|
||||||
|
|
||||||
|
[Fact(Skip="https://github.com/aspnet/AzureIntegration/issues/171")]
|
||||||
|
public Task ScriptIsInjected_ForNetCoreApp21_Standalone() => JavaScriptSnippetInjectionTestSuite("netcoreapp2.1", ApplicationType.Standalone);
|
||||||
|
|
||||||
|
[Fact(Skip="https://github.com/aspnet/AzureIntegration/issues/171")]
|
||||||
|
public Task ScriptIsInjected_ForNetCoreApp21_Portable() => JavaScriptSnippetInjectionTestSuite("netcoreapp2.1", ApplicationType.Portable);
|
||||||
|
|
||||||
|
private async Task JavaScriptSnippetInjectionTestSuite(string targetFramework, ApplicationType applicationType)
|
||||||
|
{
|
||||||
|
var testName = $"ApplicationInsightsJavaScriptSnippetTest_{applicationType}";
|
||||||
|
using (StartLog(out var loggerFactory, testName))
|
||||||
|
{
|
||||||
|
var logger = loggerFactory.CreateLogger(nameof(JavaScriptSnippetTest));
|
||||||
|
var deploymentParameters = new DeploymentParameters(GetApplicationPath(), ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64)
|
||||||
|
{
|
||||||
|
PublishApplicationBeforeDeployment = true,
|
||||||
|
PreservePublishedApplicationForDebugging = PreservePublishedApplicationForDebugging,
|
||||||
|
TargetFramework = targetFramework,
|
||||||
|
Configuration = GetCurrentBuildConfiguration(),
|
||||||
|
ApplicationType = applicationType,
|
||||||
|
EnvironmentName = "JavaScript",
|
||||||
|
EnvironmentVariables =
|
||||||
|
{
|
||||||
|
new KeyValuePair<string, string>(
|
||||||
|
"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES",
|
||||||
|
"Microsoft.AspNetCore.ApplicationInsights.HostingStartup"),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, loggerFactory))
|
||||||
|
{
|
||||||
|
var deploymentResult = await deployer.DeployAsync();
|
||||||
|
var httpClientHandler = new HttpClientHandler();
|
||||||
|
var httpClient = deploymentResult.CreateHttpClient(httpClientHandler);
|
||||||
|
|
||||||
|
// Request to base address and check if various parts of the body are rendered & measure the cold startup time.
|
||||||
|
var response = await RetryHelper.RetryRequest(async () =>
|
||||||
|
{
|
||||||
|
return await httpClient.GetAsync("/Home/ScriptCheck");
|
||||||
|
}, logger: logger, cancellationToken: deploymentResult.HostShutdownToken);
|
||||||
|
|
||||||
|
Assert.False(response == null, "Response object is null because the client could not " +
|
||||||
|
"connect to the server after multiple retries");
|
||||||
|
|
||||||
|
var validator = new Validator(httpClient, httpClientHandler, logger, deploymentResult);
|
||||||
|
|
||||||
|
logger.LogInformation("Verifying layout page");
|
||||||
|
await validator.VerifyLayoutPage(response);
|
||||||
|
|
||||||
|
logger.LogInformation("Verifying layout page before script");
|
||||||
|
await validator.VerifyLayoutPageBeforeScript(response);
|
||||||
|
|
||||||
|
logger.LogInformation("Verifying layout page after script");
|
||||||
|
await validator.VerifyLayoutPageAfterScript(response);
|
||||||
|
|
||||||
|
logger.LogInformation("Variation completed successfully.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,150 @@
|
||||||
|
// 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.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Server.IntegrationTesting;
|
||||||
|
using Xunit;
|
||||||
|
using Xunit.Abstractions;
|
||||||
|
|
||||||
|
namespace ApplicationInsightsJavaScriptSnippetTest
|
||||||
|
{
|
||||||
|
public class LoggingTest : ApplicationInsightsFunctionalTest
|
||||||
|
{
|
||||||
|
public LoggingTest(ITestOutputHelper output) : base(output)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public Task DefaultAILogFiltersApplied_ForNetCoreApp20_Portable() => DefaultAILogFiltersApplied("netcoreapp2.0", ApplicationType.Portable);
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public Task DefaultAILogFiltersApplied_ForNetCoreApp20_Standalone() => DefaultAILogFiltersApplied("netcoreapp2.0", ApplicationType.Standalone);
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public Task DefaultAILogFiltersApplied_ForNetCoreApp21_Portable() => DefaultAILogFiltersApplied("netcoreapp2.1", ApplicationType.Portable);
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public Task DefaultAILogFiltersApplied_ForNetCoreApp21_Standalone() => DefaultAILogFiltersApplied("netcoreapp2.1", ApplicationType.Standalone);
|
||||||
|
|
||||||
|
private async Task DefaultAILogFiltersApplied(string targetFramework, ApplicationType applicationType)
|
||||||
|
{
|
||||||
|
var responseText = await RunRequest(targetFramework, applicationType, "DefaultLogging");
|
||||||
|
|
||||||
|
// Enabled by default
|
||||||
|
Assert.Contains("System warning log", responseText);
|
||||||
|
// Disabled by default
|
||||||
|
Assert.DoesNotContain("System information log", responseText);
|
||||||
|
// Disabled by default
|
||||||
|
Assert.DoesNotContain("System trace log", responseText);
|
||||||
|
|
||||||
|
// Enabled by default
|
||||||
|
Assert.Contains("Microsoft warning log", responseText);
|
||||||
|
// Disabled by default but overridden by ApplicationInsights.settings.json
|
||||||
|
Assert.Contains("Microsoft information log", responseText);
|
||||||
|
// Disabled by default
|
||||||
|
Assert.DoesNotContain("Microsoft trace log", responseText);
|
||||||
|
|
||||||
|
// Enabled by default
|
||||||
|
Assert.Contains("Custom warning log", responseText);
|
||||||
|
// Enabled by default
|
||||||
|
Assert.Contains("Custom information log", responseText);
|
||||||
|
// Disabled by default
|
||||||
|
Assert.DoesNotContain("Custom trace log", responseText);
|
||||||
|
|
||||||
|
// Enabled by default
|
||||||
|
Assert.Contains("Specific warning log", responseText);
|
||||||
|
// Enabled by default
|
||||||
|
Assert.Contains("Specific information log", responseText);
|
||||||
|
// Disabled by default but overridden by ApplicationInsights.settings.json
|
||||||
|
Assert.Contains("Specific trace log", responseText);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public Task CustomAILogFiltersApplied_ForNetCoreApp20_Portable() => CustomAILogFiltersApplied("netcoreapp2.0", ApplicationType.Portable);
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public Task CustomAILogFiltersApplied_ForNetCoreApp20_Standalone() => CustomAILogFiltersApplied("netcoreapp2.0", ApplicationType.Standalone);
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public Task CustomAILogFiltersApplied_ForNetCoreApp21_Portable() => CustomAILogFiltersApplied("netcoreapp2.1", ApplicationType.Portable);
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public Task CustomAILogFiltersApplied_ForNetCoreApp21_Standalone() => CustomAILogFiltersApplied("netcoreapp2.1", ApplicationType.Standalone);
|
||||||
|
|
||||||
|
private async Task CustomAILogFiltersApplied(string targetFramework, ApplicationType applicationType)
|
||||||
|
{
|
||||||
|
var responseText = await RunRequest(targetFramework, applicationType, "CustomLogging");
|
||||||
|
// Custom logger allows only namespaces with 'o' in the name
|
||||||
|
|
||||||
|
Assert.DoesNotContain("System warning log", responseText);
|
||||||
|
Assert.DoesNotContain("System information log", responseText);
|
||||||
|
Assert.DoesNotContain("System trace log", responseText);
|
||||||
|
|
||||||
|
// Enabled by default
|
||||||
|
Assert.Contains("Microsoft warning log", responseText);
|
||||||
|
Assert.Contains("Microsoft information log", responseText);
|
||||||
|
Assert.DoesNotContain("Microsoft trace log", responseText);
|
||||||
|
|
||||||
|
// Enabled by default
|
||||||
|
Assert.Contains("Custom warning log", responseText);
|
||||||
|
Assert.Contains("Custom information log", responseText);
|
||||||
|
Assert.DoesNotContain("Custom trace log", responseText);
|
||||||
|
|
||||||
|
// Enabled by default
|
||||||
|
Assert.DoesNotContain("Specific warning log", responseText);
|
||||||
|
Assert.DoesNotContain("Specific information log", responseText);
|
||||||
|
Assert.DoesNotContain("Specific trace log", responseText);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<string> RunRequest(string targetFramework, ApplicationType applicationType, string environment)
|
||||||
|
{
|
||||||
|
string responseText;
|
||||||
|
var testName = $"ApplicationInsightsLoggingTest_{applicationType}";
|
||||||
|
using (StartLog(out var loggerFactory, testName))
|
||||||
|
{
|
||||||
|
var logger = loggerFactory.CreateLogger(nameof(JavaScriptSnippetTest));
|
||||||
|
var deploymentParameters = new DeploymentParameters(GetApplicationPath(), ServerType.Kestrel,
|
||||||
|
RuntimeFlavor.CoreClr, RuntimeArchitecture.x64)
|
||||||
|
{
|
||||||
|
ApplicationBaseUriHint = "http://localhost:0",
|
||||||
|
PublishApplicationBeforeDeployment = true,
|
||||||
|
PreservePublishedApplicationForDebugging = PreservePublishedApplicationForDebugging,
|
||||||
|
TargetFramework = "netcoreapp2.0",
|
||||||
|
Configuration = GetCurrentBuildConfiguration(),
|
||||||
|
ApplicationType = applicationType,
|
||||||
|
EnvironmentName = environment,
|
||||||
|
EnvironmentVariables =
|
||||||
|
{
|
||||||
|
new KeyValuePair<string, string>(
|
||||||
|
"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES",
|
||||||
|
"Microsoft.AspNetCore.ApplicationInsights.HostingStartup"),
|
||||||
|
new KeyValuePair<string, string>(
|
||||||
|
"HOME",
|
||||||
|
Path.Combine(GetApplicationPath(), "home"))
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, loggerFactory))
|
||||||
|
{
|
||||||
|
var deploymentResult = await deployer.DeployAsync();
|
||||||
|
var httpClientHandler = new HttpClientHandler();
|
||||||
|
var httpClient = deploymentResult.CreateHttpClient(httpClientHandler);
|
||||||
|
|
||||||
|
// Request to base address and check if various parts of the body are rendered & measure the cold startup time.
|
||||||
|
var response = await RetryHelper.RetryRequest(
|
||||||
|
async () => await httpClient.GetAsync("/log"),
|
||||||
|
logger: logger, cancellationToken: deploymentResult.HostShutdownToken);
|
||||||
|
|
||||||
|
Assert.False(response == null, "Response object is null because the client could not " +
|
||||||
|
"connect to the server after multiple retries");
|
||||||
|
|
||||||
|
responseText = await response.Content.ReadAsStringAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return responseText;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
[assembly: CollectionBehavior(CollectionBehavior.CollectionPerAssembly)]
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Home Page - ApplicationInsightsJavaScriptSnippetSample</title>
|
||||||
|
<script>document.write('Head tag script. Look for Application Insights JavaScriptSnippet below this script in the HTML file.')</script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
({
|
||||||
|
instrumentationKey: '11111111-2222-3333-4444-555555555555'
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container body-content">
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
<footer>
|
||||||
|
<p>© 2017 - ApplicationInsightsJavaScriptSnippetSample</p>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,191 @@
|
||||||
|
// 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 System.IO;
|
||||||
|
using System.Net;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Server.IntegrationTesting;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace ApplicationInsightsJavaScriptSnippetTest
|
||||||
|
{
|
||||||
|
public class Validator
|
||||||
|
{
|
||||||
|
private HttpClient _httpClient;
|
||||||
|
|
||||||
|
private HttpClientHandler _httpClientHandler;
|
||||||
|
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
|
private readonly DeploymentResult _deploymentResult;
|
||||||
|
|
||||||
|
private static readonly Assembly _resourcesAssembly = typeof(JavaScriptSnippetTest).GetTypeInfo().Assembly;
|
||||||
|
|
||||||
|
public Validator(
|
||||||
|
HttpClient httpClient,
|
||||||
|
HttpClientHandler httpClientHandler,
|
||||||
|
ILogger logger,
|
||||||
|
DeploymentResult deploymentResult)
|
||||||
|
{
|
||||||
|
_httpClient = httpClient;
|
||||||
|
_httpClientHandler = httpClientHandler;
|
||||||
|
_logger = logger;
|
||||||
|
_deploymentResult = deploymentResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task VerifyLayoutPage(HttpResponseMessage response)
|
||||||
|
{
|
||||||
|
var responseContent = await response.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
|
if (response.StatusCode != HttpStatusCode.OK)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Layout page : {0}", responseContent);
|
||||||
|
}
|
||||||
|
|
||||||
|
await ValidateLayoutPage(responseContent);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task VerifyLayoutPageBeforeScript(HttpResponseMessage response)
|
||||||
|
{
|
||||||
|
var responseContent = await response.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
|
if (response.StatusCode != HttpStatusCode.OK)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Before app insights script : {0}", responseContent);
|
||||||
|
}
|
||||||
|
|
||||||
|
await ValidateLayoutPageBeforeScript(responseContent);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task VerifyLayoutPageAfterScript(HttpResponseMessage response)
|
||||||
|
{
|
||||||
|
var responseContent = await response.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
|
if (response.StatusCode != HttpStatusCode.OK)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("After app insights script : {0}", responseContent);
|
||||||
|
}
|
||||||
|
|
||||||
|
await ValidateLayoutPageAfterScript(responseContent);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Does not check the contents of the JavaScriptSnippet as it might change. Only checks the instrumentation key.
|
||||||
|
private async Task ValidateLayoutPage(string responseContent)
|
||||||
|
{
|
||||||
|
var outputFile = "Rendered.html";
|
||||||
|
var expectedContent = await ReadResourceAsync(_resourcesAssembly, outputFile, sourceFile: false);
|
||||||
|
foreach (var substring in expectedContent)
|
||||||
|
{
|
||||||
|
#if GENERATE_BASELINES
|
||||||
|
ResourceFile.UpdateFile(_resourcesAssembly, outputFile, expectedContent, responseContent);
|
||||||
|
#else
|
||||||
|
Assert.Contains(substring, responseContent);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task ValidateLayoutPageBeforeScript(string responseContent)
|
||||||
|
{
|
||||||
|
var outputFile = "BeforeScript.html";
|
||||||
|
var expectedContent = await ReadResourceAsync(_resourcesAssembly, outputFile, sourceFile: false);
|
||||||
|
|
||||||
|
foreach (var substring in expectedContent)
|
||||||
|
{
|
||||||
|
#if GENERATE_BASELINES
|
||||||
|
ResourceFile.UpdateFile(_resourcesAssembly, outputFile, expectedContent, responseContent);
|
||||||
|
#else
|
||||||
|
Assert.Contains(substring, responseContent);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task ValidateLayoutPageAfterScript(string responseContent)
|
||||||
|
{
|
||||||
|
var outputFile = "AfterScript.html";
|
||||||
|
var expectedContent = await ReadResourceAsync(_resourcesAssembly, outputFile, sourceFile: false);
|
||||||
|
|
||||||
|
foreach (var substring in expectedContent)
|
||||||
|
{
|
||||||
|
#if GENERATE_BASELINES
|
||||||
|
ResourceFile.UpdateFile(_resourcesAssembly, outputFile, expectedContent, responseContent);
|
||||||
|
#else
|
||||||
|
Assert.Contains(substring, responseContent);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static async Task<string> ReadResourceAsync(Assembly assembly, string resourceName, bool sourceFile)
|
||||||
|
{
|
||||||
|
using (var stream = GetResourceStream(assembly, resourceName, sourceFile))
|
||||||
|
{
|
||||||
|
if (stream == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
using (var streamReader = new StreamReader(stream))
|
||||||
|
{
|
||||||
|
return await streamReader.ReadToEndAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Stream GetResourceStream(Assembly assembly, string resourceName, bool sourceFile)
|
||||||
|
{
|
||||||
|
var fullName = $"{ assembly.GetName().Name }.{ resourceName.Replace('/', '.') }";
|
||||||
|
if (!Exists(assembly, fullName))
|
||||||
|
{
|
||||||
|
#if GENERATE_BASELINES
|
||||||
|
if (sourceFile)
|
||||||
|
{
|
||||||
|
// Even when generating baselines, a missing source file is a serious problem.
|
||||||
|
Assert.True(false, $"Manifest resource: { fullName } not found.");
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
// When not generating baselines, a missing source or output file is always an error.
|
||||||
|
Assert.True(false, $"Manifest resource '{ fullName }' not found.");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var stream = assembly.GetManifestResourceStream(fullName);
|
||||||
|
if (sourceFile)
|
||||||
|
{
|
||||||
|
// Normalize line endings to '\r\n' (CRLF). This removes core.autocrlf, core.eol, core.safecrlf, and
|
||||||
|
// .gitattributes from the equation and treats "\r\n" and "\n" as equivalent. Does not handle
|
||||||
|
// some line endings like "\r" but otherwise ensures checksums and line mappings are consistent.
|
||||||
|
string text;
|
||||||
|
using (var streamReader = new StreamReader(stream))
|
||||||
|
{
|
||||||
|
text = streamReader.ReadToEnd().Replace("\r", "").Replace("\n", "\r\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
var bytes = Encoding.UTF8.GetBytes(text);
|
||||||
|
stream = new MemoryStream(bytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
return stream;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool Exists(Assembly assembly, string fullName)
|
||||||
|
{
|
||||||
|
var resourceNames = assembly.GetManifestResourceNames();
|
||||||
|
foreach (var resourceName in resourceNames)
|
||||||
|
{
|
||||||
|
// Resource names are case-sensitive.
|
||||||
|
if (string.Equals(fullName, resourceName, StringComparison.Ordinal))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
<Project>
|
||||||
|
<Import Project="..\Directory.Build.props" />
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<DeveloperBuildTestTfms>netcoreapp2.1</DeveloperBuildTestTfms>
|
||||||
|
<StandardTestTfms>$(DeveloperBuildTestTfms)</StandardTestTfms>
|
||||||
|
<StandardTestTfms Condition=" '$(DeveloperBuild)' != 'true' ">netcoreapp2.1;netcoreapp2.0</StandardTestTfms>
|
||||||
|
<StandardTestTfms Condition=" '$(DeveloperBuild)' != 'true' AND '$(OS)' == 'Windows_NT' ">$(StandardTestTfms);net461</StandardTestTfms>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Internal.AspNetCore.Sdk" PrivateAssets="All" Version="$(InternalAspNetCoreSdkPackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkPackageVersion)" />
|
||||||
|
<PackageReference Include="Moq" Version="$(MoqPackageVersion)" />
|
||||||
|
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitRunnerVisualStudioPackageVersion)" />
|
||||||
|
<PackageReference Include="xunit" Version="$(XunitPackageVersion)" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,70 @@
|
||||||
|
{
|
||||||
|
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
||||||
|
"contentVersion": "1.0.0.0",
|
||||||
|
"parameters": {
|
||||||
|
"siteName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"hostingPlanName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"resourceGroupName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"extensionFeed": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"extensionName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"extensionVersion": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"resources": [
|
||||||
|
{
|
||||||
|
"apiVersion": "2015-08-01",
|
||||||
|
"name": "[parameters('hostingPlanName')]",
|
||||||
|
"location": "West US 2",
|
||||||
|
"type": "Microsoft.Web/serverfarms",
|
||||||
|
"sku": {
|
||||||
|
"name": "D1"
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"apiVersion": "2015-08-01",
|
||||||
|
"name": "[parameters('siteName')]",
|
||||||
|
"type": "Microsoft.Web/sites",
|
||||||
|
"location": "West US 2",
|
||||||
|
"properties": {
|
||||||
|
"serverFarmId": "[resourceId(parameters('resourceGroupName'), 'Microsoft.Web/serverFarms', parameters('hostingPlanName'))]"
|
||||||
|
},
|
||||||
|
"resources": [
|
||||||
|
{
|
||||||
|
"type": "siteextensions",
|
||||||
|
"name": "[parameters('extensionName')]",
|
||||||
|
"apiVersion": "2015-08-01",
|
||||||
|
"location": "West US 2",
|
||||||
|
"properties": {
|
||||||
|
"version": "[parameters('extensionVersion')]",
|
||||||
|
"feed_url": "[parameters('extensionFeed')]"
|
||||||
|
},
|
||||||
|
"dependsOn": [
|
||||||
|
"[resourceId('Microsoft.Web/Sites', parameters('siteName'))]"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dependsOn": [
|
||||||
|
"[resourceId('Microsoft.Web/serverfarms', parameters('hostingPlanName'))]"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputs": {
|
||||||
|
"siteId": {
|
||||||
|
"type": "string",
|
||||||
|
"value": "[resourceId(parameters('resourceGroupName'), 'Microsoft.Web/sites', parameters('siteName'))]"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"directory": "wwwroot/lib"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace AspNetCore1xMvc.Controllers
|
||||||
|
{
|
||||||
|
public class HomeController : Controller
|
||||||
|
{
|
||||||
|
public IActionResult Index()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IActionResult About()
|
||||||
|
{
|
||||||
|
ViewData["Message"] = "Your application description page.";
|
||||||
|
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IActionResult Contact()
|
||||||
|
{
|
||||||
|
ViewData["Message"] = "Your contact page.";
|
||||||
|
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IActionResult Error()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
|
||||||
|
namespace AspNetCore1xMvc
|
||||||
|
{
|
||||||
|
public class Program
|
||||||
|
{
|
||||||
|
public static void Main(string[] args)
|
||||||
|
{
|
||||||
|
var host = new WebHostBuilder()
|
||||||
|
.UseKestrel()
|
||||||
|
.UseContentRoot(Directory.GetCurrentDirectory())
|
||||||
|
.UseIISIntegration()
|
||||||
|
.UseStartup<Startup>()
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
host.Run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Builder;
|
||||||
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace AspNetCore1xMvc
|
||||||
|
{
|
||||||
|
public class Startup
|
||||||
|
{
|
||||||
|
public Startup(IHostingEnvironment env)
|
||||||
|
{
|
||||||
|
var builder = new ConfigurationBuilder()
|
||||||
|
.SetBasePath(env.ContentRootPath)
|
||||||
|
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
|
||||||
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
|
||||||
|
.AddEnvironmentVariables();
|
||||||
|
Configuration = builder.Build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IConfigurationRoot Configuration { get; }
|
||||||
|
|
||||||
|
// This method gets called by the runtime. Use this method to add services to the container.
|
||||||
|
public void ConfigureServices(IServiceCollection services)
|
||||||
|
{
|
||||||
|
// Add framework services.
|
||||||
|
services.AddMvc();
|
||||||
|
}
|
||||||
|
|
||||||
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||||
|
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
|
||||||
|
{
|
||||||
|
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
|
||||||
|
loggerFactory.AddDebug();
|
||||||
|
|
||||||
|
if (env.IsDevelopment())
|
||||||
|
{
|
||||||
|
app.UseDeveloperExceptionPage();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
app.UseExceptionHandler("/Home/Error");
|
||||||
|
}
|
||||||
|
|
||||||
|
app.UseStaticFiles();
|
||||||
|
|
||||||
|
app.UseMvc(routes =>
|
||||||
|
{
|
||||||
|
routes.MapRoute(
|
||||||
|
name: "default",
|
||||||
|
template: "{controller=Home}/{action=Index}/{id?}");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "About";
|
||||||
|
}
|
||||||
|
<h2>@ViewData["Title"].</h2>
|
||||||
|
<h3>@ViewData["Message"]</h3>
|
||||||
|
|
||||||
|
<p>Use this area to provide additional information.</p>
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Contact";
|
||||||
|
}
|
||||||
|
<h2>@ViewData["Title"].</h2>
|
||||||
|
<h3>@ViewData["Message"]</h3>
|
||||||
|
|
||||||
|
<address>
|
||||||
|
One Microsoft Way<br />
|
||||||
|
Redmond, WA 98052-6399<br />
|
||||||
|
<abbr title="Phone">P:</abbr>
|
||||||
|
425.555.0100
|
||||||
|
</address>
|
||||||
|
|
||||||
|
<address>
|
||||||
|
<strong>Support:</strong> <a href="mailto:Support@example.com">Support@example.com</a><br />
|
||||||
|
<strong>Marketing:</strong> <a href="mailto:Marketing@example.com">Marketing@example.com</a>
|
||||||
|
</address>
|
||||||
|
|
@ -0,0 +1,108 @@
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Home Page";
|
||||||
|
}
|
||||||
|
|
||||||
|
<div id="myCarousel" class="carousel slide" data-ride="carousel" data-interval="6000">
|
||||||
|
<ol class="carousel-indicators">
|
||||||
|
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
|
||||||
|
<li data-target="#myCarousel" data-slide-to="1"></li>
|
||||||
|
<li data-target="#myCarousel" data-slide-to="2"></li>
|
||||||
|
<li data-target="#myCarousel" data-slide-to="3"></li>
|
||||||
|
</ol>
|
||||||
|
<div class="carousel-inner" role="listbox">
|
||||||
|
<div class="item active">
|
||||||
|
<img src="~/images/banner1.svg" alt="ASP.NET" class="img-responsive" />
|
||||||
|
<div class="carousel-caption" role="option">
|
||||||
|
<p>
|
||||||
|
Learn how to build ASP.NET apps that can run anywhere.
|
||||||
|
<a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkID=525028&clcid=0x409">
|
||||||
|
Learn More
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="item">
|
||||||
|
<img src="~/images/banner2.svg" alt="Visual Studio" class="img-responsive" />
|
||||||
|
<div class="carousel-caption" role="option">
|
||||||
|
<p>
|
||||||
|
There are powerful new features in Visual Studio for building modern web apps.
|
||||||
|
<a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkID=525030&clcid=0x409">
|
||||||
|
Learn More
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="item">
|
||||||
|
<img src="~/images/banner3.svg" alt="Package Management" class="img-responsive" />
|
||||||
|
<div class="carousel-caption" role="option">
|
||||||
|
<p>
|
||||||
|
Bring in libraries from NuGet, Bower, and npm, and automate tasks using Grunt or Gulp.
|
||||||
|
<a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkID=525029&clcid=0x409">
|
||||||
|
Learn More
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="item">
|
||||||
|
<img src="~/images/banner4.svg" alt="Microsoft Azure" class="img-responsive" />
|
||||||
|
<div class="carousel-caption" role="option">
|
||||||
|
<p>
|
||||||
|
Learn how Microsoft's Azure cloud platform allows you to build, deploy, and scale web apps.
|
||||||
|
<a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkID=525027&clcid=0x409">
|
||||||
|
Learn More
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
|
||||||
|
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
|
||||||
|
<span class="sr-only">Previous</span>
|
||||||
|
</a>
|
||||||
|
<a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
|
||||||
|
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
|
||||||
|
<span class="sr-only">Next</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-3">
|
||||||
|
<h2>Application uses</h2>
|
||||||
|
<ul>
|
||||||
|
<li>Sample pages using ASP.NET Core MVC</li>
|
||||||
|
<li><a href="https://go.microsoft.com/fwlink/?LinkId=518004">Bower</a> for managing client-side libraries</li>
|
||||||
|
<li>Theming using <a href="https://go.microsoft.com/fwlink/?LinkID=398939">Bootstrap</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<h2>How to</h2>
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://go.microsoft.com/fwlink/?LinkID=398600">Add a Controller and View</a></li>
|
||||||
|
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699315">Manage User Secrets using Secret Manager.</a></li>
|
||||||
|
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699316">Use logging to log a message.</a></li>
|
||||||
|
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699317">Add packages using NuGet.</a></li>
|
||||||
|
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699318">Add client packages using Bower.</a></li>
|
||||||
|
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699319">Target development, staging or production environment.</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<h2>Overview</h2>
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://go.microsoft.com/fwlink/?LinkId=518008">Conceptual overview of what is ASP.NET Core</a></li>
|
||||||
|
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699320">Fundamentals of ASP.NET Core such as Startup and middleware.</a></li>
|
||||||
|
<li><a href="https://go.microsoft.com/fwlink/?LinkId=398602">Working with Data</a></li>
|
||||||
|
<li><a href="https://go.microsoft.com/fwlink/?LinkId=398603">Security</a></li>
|
||||||
|
<li><a href="https://go.microsoft.com/fwlink/?LinkID=699321">Client side development</a></li>
|
||||||
|
<li><a href="https://go.microsoft.com/fwlink/?LinkID=699322">Develop on different platforms</a></li>
|
||||||
|
<li><a href="https://go.microsoft.com/fwlink/?LinkID=699323">Read more on the documentation site</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<h2>Run & Deploy</h2>
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://go.microsoft.com/fwlink/?LinkID=517851">Run your app</a></li>
|
||||||
|
<li><a href="https://go.microsoft.com/fwlink/?LinkID=517853">Run tools such as EF migrations and more</a></li>
|
||||||
|
<li><a href="https://go.microsoft.com/fwlink/?LinkID=398609">Publish to Microsoft Azure Web Apps</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Error";
|
||||||
|
}
|
||||||
|
|
||||||
|
<h1 class="text-danger">Error.</h1>
|
||||||
|
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
||||||
|
|
||||||
|
<h3>Development Mode</h3>
|
||||||
|
<p>
|
||||||
|
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong>Development environment should not be enabled in deployed applications</strong>, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>, and restarting the application.
|
||||||
|
</p>
|
||||||
|
|
@ -0,0 +1,71 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>@ViewData["Title"] - AspNetCore1xMvc</title>
|
||||||
|
|
||||||
|
<environment names="Development">
|
||||||
|
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
|
||||||
|
<link rel="stylesheet" href="~/css/site.css" />
|
||||||
|
</environment>
|
||||||
|
<environment names="Staging,Production">
|
||||||
|
<link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/css/bootstrap.min.css"
|
||||||
|
asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"
|
||||||
|
asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute" />
|
||||||
|
<link rel="stylesheet" href="~/css/site.min.css" asp-append-version="true" />
|
||||||
|
</environment>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<nav class="navbar navbar-inverse navbar-fixed-top">
|
||||||
|
<div class="container">
|
||||||
|
<div class="navbar-header">
|
||||||
|
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||||||
|
<span class="sr-only">Toggle navigation</span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
</button>
|
||||||
|
<a asp-area="" asp-controller="Home" asp-action="Index" class="navbar-brand">AspNetCore1xMvc</a>
|
||||||
|
</div>
|
||||||
|
<div class="navbar-collapse collapse">
|
||||||
|
<ul class="nav navbar-nav">
|
||||||
|
<li><a asp-area="" asp-controller="Home" asp-action="Index">Home</a></li>
|
||||||
|
<li><a asp-area="" asp-controller="Home" asp-action="About">About</a></li>
|
||||||
|
<li><a asp-area="" asp-controller="Home" asp-action="Contact">Contact</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
<div class="container body-content">
|
||||||
|
@RenderBody()
|
||||||
|
<hr />
|
||||||
|
<footer>
|
||||||
|
<p>© 2017 - AspNetCore1xMvc</p>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<environment names="Development">
|
||||||
|
<script src="~/lib/jquery/dist/jquery.js"></script>
|
||||||
|
<script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
|
||||||
|
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||||
|
</environment>
|
||||||
|
<environment names="Staging,Production">
|
||||||
|
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-2.2.0.min.js"
|
||||||
|
asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
|
||||||
|
asp-fallback-test="window.jQuery"
|
||||||
|
crossorigin="anonymous"
|
||||||
|
integrity="sha384-K+ctZQ+LL8q6tP7I94W+qzQsfRV2a+AfHIi9k8z8l9ggpc8X+Ytst4yBo/hH+8Fk">
|
||||||
|
</script>
|
||||||
|
<script src="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/bootstrap.min.js"
|
||||||
|
asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.min.js"
|
||||||
|
asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal"
|
||||||
|
crossorigin="anonymous"
|
||||||
|
integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa">
|
||||||
|
</script>
|
||||||
|
<script src="~/js/site.min.js" asp-append-version="true"></script>
|
||||||
|
</environment>
|
||||||
|
|
||||||
|
@RenderSection("Scripts", required: false)
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
<environment names="Development">
|
||||||
|
<script src="~/lib/jquery-validation/dist/jquery.validate.js"></script>
|
||||||
|
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js"></script>
|
||||||
|
</environment>
|
||||||
|
<environment names="Staging,Production">
|
||||||
|
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.14.0/jquery.validate.min.js"
|
||||||
|
asp-fallback-src="~/lib/jquery-validation/dist/jquery.validate.min.js"
|
||||||
|
asp-fallback-test="window.jQuery && window.jQuery.validator"
|
||||||
|
crossorigin="anonymous"
|
||||||
|
integrity="sha384-Fnqn3nxp3506LP/7Y3j/25BlWeA3PXTyT1l78LjECcPaKCV12TsZP7yyMxOe/G/k">
|
||||||
|
</script>
|
||||||
|
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validation.unobtrusive/3.2.6/jquery.validate.unobtrusive.min.js"
|
||||||
|
asp-fallback-src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"
|
||||||
|
asp-fallback-test="window.jQuery && window.jQuery.validator && window.jQuery.validator.unobtrusive"
|
||||||
|
crossorigin="anonymous"
|
||||||
|
integrity="sha384-JrXK+k53HACyavUKOsL+NkmSesD2P+73eDMrbTtTk0h4RmOF8hF8apPlkp26JlyH">
|
||||||
|
</script>
|
||||||
|
</environment>
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
@using AspNetCore1xMvc
|
||||||
|
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
@{
|
||||||
|
Layout = "_Layout";
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"IncludeScopes": false,
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Debug",
|
||||||
|
"System": "Information",
|
||||||
|
"Microsoft": "Information"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"IncludeScopes": false,
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Warning"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"name": "asp.net",
|
||||||
|
"private": true,
|
||||||
|
"dependencies": {
|
||||||
|
"bootstrap": "3.3.7",
|
||||||
|
"jquery": "2.2.0",
|
||||||
|
"jquery-validation": "1.14.0",
|
||||||
|
"jquery-validation-unobtrusive": "3.2.6"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
// Configure bundling and minification for the project.
|
||||||
|
// More info at https://go.microsoft.com/fwlink/?LinkId=808241
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"outputFileName": "wwwroot/css/site.min.css",
|
||||||
|
// An array of relative input file paths. Globbing patterns supported
|
||||||
|
"inputFiles": [
|
||||||
|
"wwwroot/css/site.css"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"outputFileName": "wwwroot/js/site.min.js",
|
||||||
|
"inputFiles": [
|
||||||
|
"wwwroot/js/site.js"
|
||||||
|
],
|
||||||
|
// Optionally specify minification options
|
||||||
|
"minify": {
|
||||||
|
"enabled": true,
|
||||||
|
"renameLocals": true
|
||||||
|
},
|
||||||
|
// Optionally generate .map file
|
||||||
|
"sourceMap": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
body {
|
||||||
|
padding-top: 50px;
|
||||||
|
padding-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Wrapping element */
|
||||||
|
/* Set some basic padding to keep content from hitting the edges */
|
||||||
|
.body-content {
|
||||||
|
padding-left: 15px;
|
||||||
|
padding-right: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set widths on the form inputs since otherwise they're 100% wide */
|
||||||
|
input,
|
||||||
|
select,
|
||||||
|
textarea {
|
||||||
|
max-width: 280px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Carousel */
|
||||||
|
.carousel-caption p {
|
||||||
|
font-size: 20px;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Make .svg files in the carousel display properly in older browsers */
|
||||||
|
.carousel-inner .item img[src$=".svg"] {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Hide/rearrange for smaller screens */
|
||||||
|
@media screen and (max-width: 767px) {
|
||||||
|
/* Hide captions */
|
||||||
|
.carousel-caption {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
body{padding-top:50px;padding-bottom:20px}.body-content{padding-left:15px;padding-right:15px}input,select,textarea{max-width:280px}.carousel-caption p{font-size:20px;line-height:1.4}.carousel-inner .item img[src$=".svg"]{width:100%}@media screen and (max-width:767px){.carousel-caption{display:none}}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 31 KiB |
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 9.5 KiB |
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 8.2 KiB |
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 11 KiB |
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 12 KiB |
|
|
@ -0,0 +1 @@
|
||||||
|
// Write your Javascript code.
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
{
|
||||||
|
"name": "bootstrap",
|
||||||
|
"description": "The most popular front-end framework for developing responsive, mobile first projects on the web.",
|
||||||
|
"keywords": [
|
||||||
|
"css",
|
||||||
|
"js",
|
||||||
|
"less",
|
||||||
|
"mobile-first",
|
||||||
|
"responsive",
|
||||||
|
"front-end",
|
||||||
|
"framework",
|
||||||
|
"web"
|
||||||
|
],
|
||||||
|
"homepage": "http://getbootstrap.com",
|
||||||
|
"license": "MIT",
|
||||||
|
"moduleType": "globals",
|
||||||
|
"main": [
|
||||||
|
"less/bootstrap.less",
|
||||||
|
"dist/js/bootstrap.js"
|
||||||
|
],
|
||||||
|
"ignore": [
|
||||||
|
"/.*",
|
||||||
|
"_config.yml",
|
||||||
|
"CNAME",
|
||||||
|
"composer.json",
|
||||||
|
"CONTRIBUTING.md",
|
||||||
|
"docs",
|
||||||
|
"js/tests",
|
||||||
|
"test-infra"
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"jquery": "1.9.1 - 3"
|
||||||
|
},
|
||||||
|
"version": "3.3.7",
|
||||||
|
"_release": "3.3.7",
|
||||||
|
"_resolution": {
|
||||||
|
"type": "version",
|
||||||
|
"tag": "v3.3.7",
|
||||||
|
"commit": "0b9c4a4007c44201dce9a6cc1a38407005c26c86"
|
||||||
|
},
|
||||||
|
"_source": "https://github.com/twbs/bootstrap.git",
|
||||||
|
"_target": "v3.3.7",
|
||||||
|
"_originalSource": "bootstrap",
|
||||||
|
"_direct": true
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue