Skip to content

Commit

Permalink
Repro projects
Browse files Browse the repository at this point in the history
  • Loading branch information
Farid Kadyrov committed Apr 22, 2020
0 parents commit df971bb
Show file tree
Hide file tree
Showing 25 changed files with 680 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Folders
artifacts/
bin/
obj/
.dotnet/
.nuget/
.packages/
.tools/
.vs/
.vscode/
node_modules/
BenchmarkDotNet.Artifacts/
.gradle/
src/SignalR/clients/**/dist/
modules/
.ionide/

# File extensions
*.aps
*.binlog
*.dll
*.DS_Store
*.exe
*.idb
*.lib
*.log
*.pch
*.pdb
*.pidb
*.psess
*.res
*.snk
*.so
*.suo
*.tlog
*.user
*.userprefs
*.vspx

# Specific files, typically generated by tools
launchSettings.json
msbuild.ProjectImports.zip
StyleCop.Cache
UpgradeLog.htm
.idea
28 changes: 28 additions & 0 deletions AiRepro.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Origin1", "Origin1\Origin1.csproj", "{985F15D9-F3D3-40D7-97B2-082A9DEB9ECF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "App2", "App2\App2.csproj", "{B5A1FDF7-37A4-4947-B627-D6A9F8123586}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "App3", "App3\App3.csproj", "{447E4F97-F345-4A5F-9B11-103AF14CB58E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{985F15D9-F3D3-40D7-97B2-082A9DEB9ECF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{985F15D9-F3D3-40D7-97B2-082A9DEB9ECF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{985F15D9-F3D3-40D7-97B2-082A9DEB9ECF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{985F15D9-F3D3-40D7-97B2-082A9DEB9ECF}.Release|Any CPU.Build.0 = Release|Any CPU
{B5A1FDF7-37A4-4947-B627-D6A9F8123586}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B5A1FDF7-37A4-4947-B627-D6A9F8123586}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B5A1FDF7-37A4-4947-B627-D6A9F8123586}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B5A1FDF7-37A4-4947-B627-D6A9F8123586}.Release|Any CPU.Build.0 = Release|Any CPU
{447E4F97-F345-4A5F-9B11-103AF14CB58E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{447E4F97-F345-4A5F-9B11-103AF14CB58E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{447E4F97-F345-4A5F-9B11-103AF14CB58E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{447E4F97-F345-4A5F-9B11-103AF14CB58E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
12 changes: 12 additions & 0 deletions App2/App2.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.13.1" />
</ItemGroup>


</Project>
21 changes: 21 additions & 0 deletions App2/App3Client.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

namespace App2
{
public class App3Client
{
private readonly HttpClient _client;

public App3Client(HttpClient client)
{
_client = client;
}

public async Task SendAsync(string message)
{
await _client.PostAsync("/ping", new StringContent(message, Encoding.UTF8, "application/json"));
}
}
}
18 changes: 18 additions & 0 deletions App2/Controllers/App2Controller.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System.Threading.Tasks;
using App2;
using Microsoft.AspNetCore.Mvc;

namespace App3.Controllers
{
[ApiController]
[Route("")]
public class App2Controller : ControllerBase
{
[HttpPost("ping")]
public async Task<IActionResult> Ping([FromBody] object message, [FromServices] App3Client client)
{
await client.SendAsync(message.ToString());
return Ok();
}
}
}
24 changes: 24 additions & 0 deletions App2/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;

namespace App2
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}

public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureLogging(l => l.AddConsole(o => o.IncludeScopes = true))
.ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup<Startup>(); });
}
}
52 changes: 52 additions & 0 deletions App2/Startup.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;

namespace App2
{
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)
{
services.AddApplicationInsightsTelemetry();

services.AddControllers();
services.AddHttpClient<App3Client>(client =>
{
client.BaseAddress = new Uri(Configuration["Dependency"]);
});
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}

app.UseRouting();

app.UseAuthorization();

app.UseEndpoints(endpoints => { endpoints.MapControllers(); });
}
}
}
9 changes: 9 additions & 0 deletions App2/appsettings.Development.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}
12 changes: 12 additions & 0 deletions App2/appsettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"Logging": {
"IncludeScopes": true,
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*",
"Dependency": "http://localhost:5002/app3"
}
12 changes: 12 additions & 0 deletions App3/App3.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.13.1" />
</ItemGroup>


</Project>
19 changes: 19 additions & 0 deletions App3/Controllers/App3Controller.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System.Text.Json;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;

namespace App3.Controllers
{
[ApiController]
[Route("")]
public class App3Controller : ControllerBase
{
[HttpPost("ping")]
public async Task<IActionResult> Ping([FromBody] object message, [FromServices] ILogger<App3Controller> logger)
{
logger.LogInformation(message.ToString());
return Ok();
}
}
}
24 changes: 24 additions & 0 deletions App3/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;

namespace App3
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}

public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureLogging(l => l.AddConsole(o => o.IncludeScopes = true))
.ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup<Startup>(); });
}
}
48 changes: 48 additions & 0 deletions App3/Startup.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;

namespace App3
{
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)
{
services.AddApplicationInsightsTelemetry();

services.AddControllers();
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}

app.UseRouting();

app.UseAuthorization();

app.UseEndpoints(endpoints => { endpoints.MapControllers(); });
}
}
}
9 changes: 9 additions & 0 deletions App3/appsettings.Development.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}
11 changes: 11 additions & 0 deletions App3/appsettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"Logging": {
"IncludeScopes": true,
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*"
}
23 changes: 23 additions & 0 deletions Origin1/App2Client.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

namespace Origin1
{
public class App2Client
{
private readonly HttpClient _client;

public App2Client(HttpClient client)
{
_client = client;
}

public async Task SendAsync(string message)
{
var resp = await _client.PostAsync("/ping", new StringContent(message, Encoding.UTF8, "application/json"));
Console.WriteLine(await resp.Content.ReadAsStringAsync());
}
}
}
Loading

0 comments on commit df971bb

Please sign in to comment.