File tree Expand file tree Collapse file tree 4 files changed +15
-7
lines changed
frameworks/CSharp/touchsocket/src Expand file tree Collapse file tree 4 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -10,12 +10,16 @@ public class Program
1010{
1111 private static async Task Main ( string [ ] args )
1212 {
13- var port = 8080 ;
13+ int port = 8080 ;
1414 var service = new MyHttpService ( ) ;
1515
1616 await service . SetupAsync ( new TouchSocketConfig ( )
1717 . SetListenIPHosts ( port )
1818 . SetMaxCount ( 1000000 )
19+ . SetTransportOption ( options =>
20+ {
21+ options . BufferOnDemand = true ;
22+ } )
1923 . ConfigureContainer ( a =>
2024 {
2125 a . AddConsoleLogger ( ) ;
Original file line number Diff line number Diff line change 1111
1212 <ItemGroup >
1313 <PackageReference Include =" Microsoft.Extensions.Hosting" Version =" 9.0.0" />
14- <PackageReference Include =" TouchSocket.Hosting" Version =" 4.0.0-rc.15 " />
15- <PackageReference Include =" TouchSocket.WebApi" Version =" 4.0.0-rc.15 " />
14+ <PackageReference Include =" TouchSocket.Hosting" Version =" 4.0.0-rc.44 " />
15+ <PackageReference Include =" TouchSocket.WebApi" Version =" 4.0.0-rc.44 " />
1616 </ItemGroup >
1717</Project >
1818
Original file line number Diff line number Diff line change @@ -19,6 +19,10 @@ public static void Main(string[] args)
1919 {
2020 config . SetListenIPHosts ( 8080 )
2121 . SetMaxCount ( 1000000 )
22+ . SetTransportOption ( options =>
23+ {
24+ options . BufferOnDemand = true ;
25+ } )
2226 . ConfigureContainer ( a =>
2327 {
2428 a . AddConsoleLogger ( ) ;
@@ -45,7 +49,7 @@ public static void Main(string[] args)
4549 } ) ;
4650 } ) ;
4751
48- var host = builder . Build ( ) ;
52+ IHost host = builder . Build ( ) ;
4953 host . Run ( ) ;
5054 }
5155}
@@ -60,7 +64,7 @@ public partial class ApiServer : SingletonRpcServer
6064 [ WebApi ( Method = HttpMethodType . Get ) ]
6165 public async Task Plaintext ( IWebApiCallContext callContext )
6266 {
63- var response = callContext . HttpContext . Response ;
67+ HttpResponse response = callContext . HttpContext . Response ;
6468 response . SetStatus ( 200 , "ok" ) ;
6569 response . Content = m_contentPlaintext ;
6670 await response . AnswerAsync ( ) . ConfigureAwait ( false ) ;
Original file line number Diff line number Diff line change 1010
1111 <ItemGroup >
1212 <PackageReference Include =" Microsoft.Extensions.Hosting" Version =" 9.0.0" />
13- <PackageReference Include =" TouchSocket.Hosting" Version =" 4.0.0-rc.15 " />
14- <PackageReference Include =" TouchSocket.WebApi" Version =" 4.0.0-rc.15 " />
13+ <PackageReference Include =" TouchSocket.Hosting" Version =" 4.0.0-rc.44 " />
14+ <PackageReference Include =" TouchSocket.WebApi" Version =" 4.0.0-rc.44 " />
1515 </ItemGroup >
1616</Project >
You can’t perform that action at this time.
0 commit comments