Skip to content
Merged
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
6 changes: 5 additions & 1 deletion frameworks/CSharp/touchsocket/src/TouchSocketHttp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@ public class Program
{
private static async Task Main(string[] args)
{
var port = 8080;
int port = 8080;
var service = new MyHttpService();

await service.SetupAsync(new TouchSocketConfig()
.SetListenIPHosts(port)
.SetMaxCount(1000000)
.SetTransportOption(options =>
{
options.BufferOnDemand = true;
})
.ConfigureContainer(a =>
{
a.AddConsoleLogger();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.0" />
<PackageReference Include="TouchSocket.Hosting" Version="4.0.0-rc.15" />
<PackageReference Include="TouchSocket.WebApi" Version="4.0.0-rc.15" />
<PackageReference Include="TouchSocket.Hosting" Version="4.0.0-rc.44" />
<PackageReference Include="TouchSocket.WebApi" Version="4.0.0-rc.44" />
</ItemGroup>
</Project>

Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ public static void Main(string[] args)
{
config.SetListenIPHosts(8080)
.SetMaxCount(1000000)
.SetTransportOption(options =>
{
options.BufferOnDemand = true;
})
.ConfigureContainer(a =>
{
a.AddConsoleLogger();
Expand All @@ -45,7 +49,7 @@ public static void Main(string[] args)
});
});

var host = builder.Build();
IHost host = builder.Build();
host.Run();
}
}
Expand All @@ -60,7 +64,7 @@ public partial class ApiServer : SingletonRpcServer
[WebApi(Method = HttpMethodType.Get)]
public async Task Plaintext(IWebApiCallContext callContext)
{
var response = callContext.HttpContext.Response;
HttpResponse response = callContext.HttpContext.Response;
response.SetStatus(200, "ok");
response.Content = m_contentPlaintext;
await response.AnswerAsync().ConfigureAwait(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.0" />
<PackageReference Include="TouchSocket.Hosting" Version="4.0.0-rc.15" />
<PackageReference Include="TouchSocket.WebApi" Version="4.0.0-rc.15" />
<PackageReference Include="TouchSocket.Hosting" Version="4.0.0-rc.44" />
<PackageReference Include="TouchSocket.WebApi" Version="4.0.0-rc.44" />
</ItemGroup>
</Project>
Loading