diff --git a/frameworks/CSharp/touchsocket/src/TouchSocketHttp/TouchSocketHttp.csproj b/frameworks/CSharp/touchsocket/src/TouchSocketHttp/TouchSocketHttp.csproj index 861df016264..aaef77cb15b 100644 --- a/frameworks/CSharp/touchsocket/src/TouchSocketHttp/TouchSocketHttp.csproj +++ b/frameworks/CSharp/touchsocket/src/TouchSocketHttp/TouchSocketHttp.csproj @@ -12,6 +12,6 @@ - + diff --git a/frameworks/CSharp/touchsocket/src/TouchSocketWebApi/Program.cs b/frameworks/CSharp/touchsocket/src/TouchSocketWebApi/Program.cs index 9ff88e76fa2..52fcf5a4edf 100644 --- a/frameworks/CSharp/touchsocket/src/TouchSocketWebApi/Program.cs +++ b/frameworks/CSharp/touchsocket/src/TouchSocketWebApi/Program.cs @@ -58,9 +58,9 @@ public static void Main(string[] args) } } -public partial class ApiServer : RpcServer +public partial class ApiServer : SingletonRpcServer { - private HttpContent m_contentPlaintext = new StringHttpContent("Hello, World!", Encoding.UTF8, $"text/plain"); + private readonly HttpContent m_contentPlaintext = new StringHttpContent("Hello, World!", Encoding.UTF8, $"text/plain"); public static MyJson MyJson { get; set; } = new MyJson() { Message = "Hello, World!" }; @@ -71,7 +71,7 @@ public async Task Plaintext(IWebApiCallContext callContext) var response= callContext.HttpContext.Response; response.SetStatus(200, "success"); response.Content= m_contentPlaintext; - await response.AnswerAsync(); + await response.AnswerAsync().ConfigureAwait(false); } [Router("/json")] diff --git a/frameworks/CSharp/touchsocket/src/TouchSocketWebApi/TouchSocketWebApi.csproj b/frameworks/CSharp/touchsocket/src/TouchSocketWebApi/TouchSocketWebApi.csproj index 87b1299e11e..6d44f27c2f5 100644 --- a/frameworks/CSharp/touchsocket/src/TouchSocketWebApi/TouchSocketWebApi.csproj +++ b/frameworks/CSharp/touchsocket/src/TouchSocketWebApi/TouchSocketWebApi.csproj @@ -12,8 +12,8 @@ - - - + + +