-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
create dotnet core FastHttpApi http server #4178
Merged
Merged
Changes from 34 commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
05174a3
no message
beetlex-io e6f9295
Update README.md
beetlex-io 74f7bda
change with ' invalid reference format: repository name must be lower…
beetlex-io 609f192
add notfound rewrite
beetlex-io 10f9545
update fasthttpapi to 1.0.0.8
beetlex-io 4ca9747
display error log
beetlex-io 37fea83
set listen port to 80
beetlex-io 1c65a10
no message
beetlex-io f0226a9
no message
beetlex-io 27f6e65
listen 127.0.0.1
beetlex-io ff84ba8
no message
beetlex-io a73623c
test
beetlex-io e6edc0a
no message
beetlex-io be52432
support ipv6
beetlex-io 92348c2
no message
beetlex-io 957474f
change benchmark_config sebserver name
beetlex-io 04428aa
no message
beetlex-io 2263cd1
remove console read
beetlex-io 6c806a8
dockerfile add
beetlex-io 00f5bd8
using HostBuilder run app.
beetlex-io 807e0f8
FROM microsoft/dotnet:2.1-runtime-nanoserver
beetlex-io 94eeaba
change logtype to Warring
beetlex-io eb8151c
add PlatformBenchmarks
beetlex-io e3b4b20
change beetle-base dockerfile
beetlex-io ffd4691
PlatformBenchmarks set content-type
beetlex-io ae0ba77
no message
beetlex-io 9b150bf
change defalut test
beetlex-io 84480b5
update default Benchmarks
beetlex-io 1d5d874
Change the framework name to beetlex
beetlex-io 3d386da
Change using IHostedService
beetlex-io bce6fe3
change to buider run
beetlex-io c9d5f69
delete Benchmarks.csproj.user file
beetlex-io ec10afe
remove PlatformBenchmarks test
beetlex-io 8188894
update header DATE
beetlex-io e96d838
Remove extra space
beetlex-io e6cb093
change FastHttpApi directory to beetlex
beetlex-io File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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,31 @@ | ||
| ||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 15 | ||
VisualStudioVersion = 15.0.28010.2036 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Benchmarks", "Benchmarks\Benchmarks.csproj", "{12CA0190-5EA2-460F-ABC4-FAD454148EBF}" | ||
EndProject | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PlatformBenchmarks", "PlatformBenchmarks\PlatformBenchmarks.csproj", "{4C067352-BD7E-45A0-ACFA-612902887C81}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{12CA0190-5EA2-460F-ABC4-FAD454148EBF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{12CA0190-5EA2-460F-ABC4-FAD454148EBF}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{12CA0190-5EA2-460F-ABC4-FAD454148EBF}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{12CA0190-5EA2-460F-ABC4-FAD454148EBF}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{4C067352-BD7E-45A0-ACFA-612902887C81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{4C067352-BD7E-45A0-ACFA-612902887C81}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{4C067352-BD7E-45A0-ACFA-612902887C81}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{4C067352-BD7E-45A0-ACFA-612902887C81}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {08385ADD-0FB3-41AC-83DF-35149057455E} | ||
EndGlobalSection | ||
EndGlobal |
14 changes: 14 additions & 0 deletions
14
frameworks/CSharp/FastHttpApi/Benchmarks/Benchmarks.csproj
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,14 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>netcoreapp2.1</TargetFramework> | ||
<ServerGarbageCollection>true</ServerGarbageCollection> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="BeetleX.FastHttpApi" Version="1.0.1" /> | ||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="2.1.1" /> | ||
</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,72 @@ | ||
using BeetleX.FastHttpApi; | ||
using Microsoft.Extensions.Hosting; | ||
using System.Threading.Tasks; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using System; | ||
using System.Threading; | ||
|
||
|
||
namespace Benchmarks | ||
{ | ||
|
||
[BeetleX.FastHttpApi.Controller] | ||
class Program | ||
{ | ||
private static string mDate; | ||
public static void Main(string[] args) | ||
{ | ||
|
||
var builder = new HostBuilder() | ||
.ConfigureServices((hostContext, services) => | ||
{ | ||
services.AddHostedService<BeetleXHttpServer>(); | ||
}); | ||
builder.Build().Run(); | ||
} | ||
|
||
public object plaintext(IHttpContext context) | ||
{ | ||
context.Response.Header[HeaderTypeFactory.DATE] = DateTime.Now.ToUniversalTime().ToString("r"); | ||
return new TextResult("Hello, World!"); | ||
} | ||
public object json(IHttpContext context) | ||
{ | ||
context.Response.Header[HeaderTypeFactory.DATE] = DateTime.Now.ToUniversalTime().ToString("r"); | ||
return new JsonResult(new JsonMessage { message = "Hello, World!" }); | ||
} | ||
|
||
public class JsonMessage | ||
{ | ||
public string message { get; set; } | ||
} | ||
|
||
|
||
} | ||
|
||
public class BeetleXHttpServer : IHostedService | ||
{ | ||
private HttpApiServer mApiServer; | ||
|
||
public virtual Task StartAsync(CancellationToken cancellationToken) | ||
{ | ||
mApiServer = new HttpApiServer(); | ||
mApiServer.Register(typeof(Program).Assembly); | ||
mApiServer.ServerConfig.Port = 8080; | ||
mApiServer.ServerConfig.MaxConnections = 100000; | ||
mApiServer.ServerConfig.UrlIgnoreCase = false; | ||
mApiServer.ServerConfig.LogLevel = BeetleX.EventArgs.LogType.Warring; | ||
mApiServer.ServerConfig.LogToConsole = true; | ||
mApiServer.Open(); | ||
Console.WriteLine("BeetleX FastHttpApi server"); | ||
Console.WriteLine($"ServerGC:{System.Runtime.GCSettings.IsServerGC}"); | ||
Console.Write(mApiServer.BaseServer); | ||
return Task.CompletedTask; | ||
} | ||
|
||
public virtual Task StopAsync(CancellationToken cancellationToken) | ||
{ | ||
mApiServer.BaseServer.Dispose(); | ||
return Task.CompletedTask; | ||
} | ||
} | ||
} |
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,25 @@ | ||
# FastHttpApi Tests on Linux and windows | ||
This includes tests for plaintext and json serialization. | ||
|
||
## Infrastructure Software Versions | ||
|
||
**Language** | ||
|
||
* C# 7.0 | ||
|
||
**Platforms** | ||
|
||
* .NET Core (Windows and Linux) | ||
|
||
**Web Servers** | ||
|
||
* [FastHttpApi](https://github.com/IKende/FastHttpApi) | ||
|
||
**Web Stack** | ||
|
||
* [FastHttpApi](https://github.com/IKende/FastHttpApi) | ||
|
||
## Paths & Source for Tests | ||
|
||
* [Plaintext](Benchmarks/Program.cs): "/plaintext" | ||
* [JSON Serialization](Benchmarks/Program.cs): "/json" |
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,7 @@ | ||
FROM microsoft/dotnet:2.1-sdk-stretch AS build | ||
WORKDIR /app | ||
COPY Benchmarks . | ||
RUN dotnet publish -c Release -o out | ||
|
||
WORKDIR /app/out | ||
ENTRYPOINT ["dotnet", "Benchmarks.dll"] |
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,26 @@ | ||
{ | ||
"framework": "beetlex", | ||
"tests": [ | ||
{ | ||
"default": { | ||
"plaintext_url": "/plaintext", | ||
"json_url": "/json", | ||
"port": 8080, | ||
"approach": "Realistic", | ||
"classification": "Micro", | ||
"database": "None", | ||
"framework": "beetlex", | ||
"language": "C#", | ||
"orm": "Raw", | ||
"platform": ".NET", | ||
"flavor": "CoreCLR", | ||
"webserver": "BeetleX", | ||
"os": "Linux", | ||
"database_os": "Linux", | ||
"display_name": "beetlex", | ||
"notes": "", | ||
"versus": "beetlex" | ||
} | ||
} | ||
] | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Remove extra space.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank