Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions Counter/Counter.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net461</TargetFramework>
<RuntimeIdentifier>win7-x64</RuntimeIdentifier>
</PropertyGroup>
<PropertyGroup>
<IsServiceFabricServiceProject>True</IsServiceFabricServiceProject>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Microsoft.ServiceFabric.AspNetCore.Hosting\Microsoft.ServiceFabric.AspNetCore.Hosting.csproj" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
</ItemGroup>
</Project>
19 changes: 0 additions & 19 deletions Counter/Counter.xproj

This file was deleted.

14 changes: 11 additions & 3 deletions Counter/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,31 @@
using Microsoft.ServiceFabric.AspNetCore.Hosting;
using Microsoft.ServiceFabric.Services.Runtime;
using System.IO;
using System.Threading.Tasks;

namespace Counter
{
public static class Program
{
public static void Main(string[] args)
{
MainAsync(args).GetAwaiter().GetResult();
}

private static async Task MainAsync(string[] args)
{
var communicationContext = CreateAspNetCoreCommunicationContext();

ServiceRuntime.RegisterServiceAsync("CounterType", serviceContext => new CounterService(serviceContext, communicationContext)).GetAwaiter().GetResult();
await communicationContext.WebHost.StartAsync();

await ServiceRuntime.RegisterServiceAsync("CounterType", serviceContext => new CounterService(serviceContext, communicationContext));

communicationContext.WebHost.Run();
await communicationContext.WebHost.WaitForShutdownAsync();
}

private static AspNetCoreCommunicationContext CreateAspNetCoreCommunicationContext()
{
var webHost = new WebHostBuilder().UseWebListener()
var webHost = new WebHostBuilder().UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.UseServiceFabricEndpoint("CounterTypeEndpoint")
Expand Down
16 changes: 13 additions & 3 deletions Counter/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
{
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:4003/",
"applicationUrl": "http://localhost:62539/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "api/values",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Counter": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "api/values",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:62540"
}
}
}
}
6 changes: 3 additions & 3 deletions Counter/app.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<configuration>
<runtime>
<gcServer enabled="true"/>
</runtime>
<runtime>
<gcServer enabled="true"/>
</runtime>
</configuration>
10 changes: 10 additions & 0 deletions Counter/appsettings.Development.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
}
}
}
4 changes: 1 addition & 3 deletions Counter/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Verbose",
"System": "Information",
"Microsoft": "Information"
"Default": "Warning"
}
}
}
36 changes: 0 additions & 36 deletions Counter/project.json

This file was deleted.

20 changes: 20 additions & 0 deletions Gateway/Gateway.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net461</TargetFramework>
<RuntimeIdentifier>win7-x64</RuntimeIdentifier>
</PropertyGroup>
<PropertyGroup>
<IsServiceFabricServiceProject>True</IsServiceFabricServiceProject>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Microsoft.ServiceFabric.AspNetCore.Gateway\Microsoft.ServiceFabric.AspNetCore.Gateway.csproj" />
<ProjectReference Include="..\Microsoft.ServiceFabric.AspNetCore.Hosting\Microsoft.ServiceFabric.AspNetCore.Hosting.csproj" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
</ItemGroup>
</Project>
19 changes: 0 additions & 19 deletions Gateway/Gateway.xproj

This file was deleted.

12 changes: 10 additions & 2 deletions Gateway/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,26 @@
using Microsoft.ServiceFabric.AspNetCore.Hosting;
using Microsoft.ServiceFabric.Services.Runtime;
using System.IO;
using System.Threading.Tasks;

namespace Gateway
{
public static class Program
{
public static void Main(string[] args)
{
MainAsync(args).GetAwaiter().GetResult();
}

private static async Task MainAsync(string[] args)
{
var communicationContext = CreateAspNetCoreCommunicationContext();

ServiceRuntime.RegisterServiceAsync("GatewayType", serviceContext => new GatewayService(serviceContext, communicationContext)).GetAwaiter().GetResult();
await communicationContext.WebHost.StartAsync();

await ServiceRuntime.RegisterServiceAsync("GatewayType", serviceContext => new GatewayService(serviceContext, communicationContext));

communicationContext.WebHost.Run();
await communicationContext.WebHost.WaitForShutdownAsync();
}

private static AspNetCoreCommunicationContext CreateAspNetCoreCommunicationContext()
Expand Down
16 changes: 13 additions & 3 deletions Gateway/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
{
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:12172/",
"applicationUrl": "http://localhost:62213/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "api/values",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Gateway": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "api/values",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:62214"
}
}
}
}
4 changes: 1 addition & 3 deletions Gateway/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
app.MapWhen(
context =>
{
StringValues serviceUri;

return context.Request.Headers.TryGetValue("SF-ServiceUri", out serviceUri) &&
return context.Request.Headers.TryGetValue("SF-ServiceUri", out StringValues serviceUri) &&
serviceUri.Count == 1 &&
serviceUri[0] == "fabric:/Hosting/CounterService";
},
Expand Down
6 changes: 3 additions & 3 deletions Gateway/app.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<configuration>
<runtime>
<gcServer enabled="true"/>
</runtime>
<runtime>
<gcServer enabled="true"/>
</runtime>
</configuration>
10 changes: 10 additions & 0 deletions Gateway/appsettings.Development.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
}
}
}
4 changes: 1 addition & 3 deletions Gateway/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Verbose",
"System": "Information",
"Microsoft": "Information"
"Default": "Warning"
}
}
}
35 changes: 0 additions & 35 deletions Gateway/project.json

This file was deleted.

8 changes: 8 additions & 0 deletions Hosting.TestClient/Hosting.TestClient.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>

</Project>
19 changes: 0 additions & 19 deletions Hosting.TestClient/Hosting.TestClient.xproj

This file was deleted.

Loading