-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add a webapi for F5 into debugging * Add a workspace * Fix a small thing in MultipleKeys example * Add tasks to build examples * Remove launch.json for product code * Update F5 WebApi project
- Loading branch information
1 parent
3a2f55f
commit 36e31d3
Showing
19 changed files
with
374 additions
and
90 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": ".NET Core Launch - F5 WebApi", | ||
"type": "coreclr", | ||
"request": "launch", | ||
"preLaunchTask": "Build F5 WebApi", | ||
"program": "${workspaceFolder}/F5WebApi/bin/Debug/netcoreapp2.2/F5WebApi.dll", | ||
"args": [], | ||
"cwd": "${workspaceFolder}/F5WebApi", | ||
"stopAtEntry": false, | ||
"launchBrowser": { | ||
"enabled": true | ||
}, | ||
"env": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
// See https://go.microsoft.com/fwlink/?LinkId=733558 | ||
// for the documentation about the tasks.json format | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "Build F5 WebApi", | ||
"command": "dotnet build", | ||
"type": "shell", | ||
"group": "build", | ||
"presentation": { | ||
"reveal": "always" | ||
}, | ||
"options": { | ||
"cwd": "${workspaceFolder}/F5WebApi" | ||
}, | ||
"problemMatcher": "$msCompile" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Microsoft.AspNetCore.Mvc; | ||
|
||
namespace F5WebApi.Controllers | ||
{ | ||
[Route("api/[controller]")] | ||
[ApiController] | ||
public class ValuesController : ControllerBase | ||
{ | ||
// GET api/values | ||
[HttpGet] | ||
public ActionResult<IEnumerable<string>> Get() | ||
{ | ||
return new string[] { "value1", "value2" }; | ||
} | ||
|
||
// GET api/values/5 | ||
[HttpGet("{id}")] | ||
public ActionResult<string> Get(int id) | ||
{ | ||
return "value"; | ||
} | ||
|
||
// POST api/values | ||
[HttpPost] | ||
public void Post([FromBody] string value) | ||
{ | ||
} | ||
|
||
// PUT api/values/5 | ||
[HttpPut("{id}")] | ||
public void Put(int id, [FromBody] string value) | ||
{ | ||
} | ||
|
||
// DELETE api/values/5 | ||
[HttpDelete("{id}")] | ||
public void Delete(int id) | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netcoreapp2.2</TargetFramework> | ||
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.AspNetCore.App" /> | ||
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.7.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\ApplicationInsights.Kubernetes\ApplicationInsights.Kubernetes.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using Microsoft.AspNetCore; | ||
using Microsoft.AspNetCore.Hosting; | ||
|
||
namespace F5WebApi | ||
{ | ||
public class Program | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
CreateHostBuilder(args).Build().Run(); | ||
} | ||
|
||
public static IWebHostBuilder CreateHostBuilder(string[] args) => | ||
WebHost.CreateDefaultBuilder(args) | ||
.UseStartup<Startup>(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"$schema": "http://json.schemastore.org/launchsettings.json", | ||
"iisSettings": { | ||
"windowsAuthentication": false, | ||
"anonymousAuthentication": true, | ||
"iisExpress": { | ||
"applicationUrl": "http://localhost:31345", | ||
"sslPort": 44371 | ||
} | ||
}, | ||
"profiles": { | ||
"IIS Express": { | ||
"commandName": "IISExpress", | ||
"launchBrowser": true, | ||
"launchUrl": "api/values", | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
} | ||
}, | ||
"F5WebApi": { | ||
"commandName": "Project", | ||
"launchBrowser": true, | ||
"launchUrl": "api/values", | ||
"applicationUrl": "https://localhost:5001;http://localhost:5000", | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
using System.Diagnostics; | ||
using Microsoft.ApplicationInsights.Kubernetes.Debugging; | ||
using Microsoft.AspNetCore.Builder; | ||
using Microsoft.AspNetCore.Hosting; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
namespace F5WebApi | ||
{ | ||
public class Startup | ||
{ | ||
public Startup(IConfiguration configuration) | ||
{ | ||
Configuration = configuration; | ||
} | ||
|
||
public IConfiguration Configuration { get; } | ||
|
||
// This method gets called by the runtime. Use this method to add services to the container. | ||
public void ConfigureServices(IServiceCollection services) | ||
{ | ||
// To use this project for F5 debugging, follow these steps: | ||
|
||
// Output the diagnostic source logs to the console. | ||
var observer = new ApplicationInsightsKubernetesDiagnosticObserver(DiagnosticLogLevel.Trace); | ||
ApplicationInsightsKubernetesDiagnosticSource.Instance.Observable.SubscribeWithAdapter(observer); | ||
|
||
// Step 1. Set iKey in the parameter below. | ||
services.AddApplicationInsightsTelemetry("your-instrumentation-key"); | ||
|
||
// Step 2. Call proper overloads of AddApplicationInsightsKubernetesEnricher. | ||
services.AddApplicationInsightsKubernetesEnricher(applyOptions: null, | ||
kubernetesServiceCollectionBuilder: KubernetesDebuggingServiceCollectionBuilderFactory.Instance.Create(), | ||
detectKubernetes: () => true); | ||
// Step 3. Set a break point and press F5. | ||
// ~ | ||
|
||
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); | ||
} | ||
|
||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. | ||
public void Configure(IApplicationBuilder app, IHostingEnvironment env) | ||
{ | ||
if (env.IsDevelopment()) | ||
{ | ||
app.UseDeveloperExceptionPage(); | ||
} | ||
else | ||
{ | ||
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. | ||
app.UseHsts(); | ||
} | ||
|
||
app.UseHttpsRedirection(); | ||
app.UseMvc(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "Debug", | ||
"System": "Information", | ||
"Microsoft": "Information" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "Warning", | ||
"Microsoft.Hosting.Lifetime": "Information" | ||
} | ||
}, | ||
"AllowedHosts": "*" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "Build Example - BasicConsoleApp", | ||
"command": "dotnet", | ||
"type": "shell", | ||
"group": "build", | ||
"problemMatcher": "$msCompile", | ||
"args": [ | ||
"build" | ||
], | ||
"options": { | ||
"cwd": "${workspaceFolder}/BasicConsoleApp/src/" | ||
} | ||
}, | ||
{ | ||
"label": "Build Example - BasicUsage_clr21_RBAC", | ||
"command": "dotnet", | ||
"type": "shell", | ||
"group": "build", | ||
"problemMatcher": "$msCompile", | ||
"args": [ | ||
"build" | ||
], | ||
"options": { | ||
"cwd": "${workspaceFolder}/BasicUsage_clr21_RBAC/app/" | ||
} | ||
}, | ||
{ | ||
"label": "Build Example - MultipleIKeys", | ||
"command": "dotnet", | ||
"type": "shell", | ||
"group": "build", | ||
"problemMatcher": "$msCompile", | ||
"args": [ | ||
"build" | ||
], | ||
"options": { | ||
"cwd": "${workspaceFolder}/MultipleIKeys/" | ||
} | ||
}, | ||
{ | ||
"label": "Build Example - ZeroUserCodeLightup", | ||
"command": "dotnet", | ||
"type": "shell", | ||
"group": "build", | ||
"problemMatcher": "$msCompile", | ||
"args": [ | ||
"build" | ||
], | ||
"options": { | ||
"cwd": "${workspaceFolder}/ZeroUserCodeLightup/" | ||
} | ||
}, | ||
{ | ||
"label": "Build Example - WindowsContainer", | ||
"command": "dotnet", | ||
"type": "shell", | ||
"group": "build", | ||
"problemMatcher": "$msCompile", | ||
"args": [ | ||
"build" | ||
], | ||
"options": { | ||
"cwd": "${workspaceFolder}/WindowsContainer/" | ||
} | ||
}, | ||
] | ||
} |
Oops, something went wrong.