diff --git a/NewLife.Remoting.Extensions/Controllers/BaseDeviceController.cs b/NewLife.Remoting.Extensions/Controllers/BaseDeviceController.cs
index e1261f1..b626b8c 100644
--- a/NewLife.Remoting.Extensions/Controllers/BaseDeviceController.cs
+++ b/NewLife.Remoting.Extensions/Controllers/BaseDeviceController.cs
@@ -188,9 +188,9 @@ public virtual async Task Notify()
if (HttpContext.WebSockets.IsWebSocketRequest)
{
- using var socket = await HttpContext.WebSockets.AcceptWebSocketAsync();
+ using var socket = await HttpContext.WebSockets.AcceptWebSocketAsync().ConfigureAwait(false);
- await HandleNotify(socket, Token);
+ await HandleNotify(socket, Token).ConfigureAwait(false);
}
else
HttpContext.Response.StatusCode = 400;
@@ -231,7 +231,7 @@ await socket.WaitForClose(txt =>
// 长连接上线。可能客户端心跳已经停了,WS还在,这里重新上线
_deviceService.SetOnline(device, true, token, ip);
}
- }, source);
+ }, source).ConfigureAwait(false);
WriteLog("WebSocket断开", true, $"State={socket.State} CloseStatus={socket.CloseStatus} sid={sid} Remote={remote}");
@@ -248,7 +248,7 @@ private async Task ConsumeMessage(WebSocket socket, String code, IProducerConsum
while (!cancellationToken.IsCancellationRequested && socket.State == WebSocketState.Open)
{
ISpan? span = null;
- var mqMsg = await queue.TakeOneAsync(15, cancellationToken);
+ var mqMsg = await queue.TakeOneAsync(15, cancellationToken).ConfigureAwait(false);
if (mqMsg != null)
{
// 埋点
@@ -274,14 +274,14 @@ private async Task ConsumeMessage(WebSocket socket, String code, IProducerConsum
{
WriteLog("WebSocket发送", true, mqMsg);
- await socket.SendAsync(mqMsg.GetBytes(), WebSocketMessageType.Text, true, cancellationToken);
+ await socket.SendAsync(mqMsg.GetBytes(), WebSocketMessageType.Text, true, cancellationToken).ConfigureAwait(false);
}
span?.Dispose();
}
else
{
- await Task.Delay(1_000, cancellationToken);
+ await Task.Delay(1_000, cancellationToken).ConfigureAwait(false);
}
}
}
diff --git a/NewLife.Remoting.Extensions/ModelBinders/InterfaceModelBinder.cs b/NewLife.Remoting.Extensions/ModelBinders/InterfaceModelBinder.cs
index 939dcec..6a41a74 100644
--- a/NewLife.Remoting.Extensions/ModelBinders/InterfaceModelBinder.cs
+++ b/NewLife.Remoting.Extensions/ModelBinders/InterfaceModelBinder.cs
@@ -19,7 +19,7 @@ public async Task BindModelAsync(ModelBindingContext bindingContext)
try
{
var req = bindingContext.HttpContext.Request;
- var entityBody = await req.ReadFromJsonAsync(model!.GetType());
+ var entityBody = await req.ReadFromJsonAsync(model!.GetType()).ConfigureAwait(false);
bindingContext.Result = ModelBindingResult.Success(entityBody);
}
diff --git a/NewLife.Remoting.Extensions/NewLife.Remoting.Extensions.csproj b/NewLife.Remoting.Extensions/NewLife.Remoting.Extensions.csproj
index 910f014..93596ec 100644
--- a/NewLife.Remoting.Extensions/NewLife.Remoting.Extensions.csproj
+++ b/NewLife.Remoting.Extensions/NewLife.Remoting.Extensions.csproj
@@ -20,6 +20,7 @@
True
..\Doc\newlife.snk
1701;1702;NU5104;NETSDK1138;CS7035
+ CA2007
diff --git a/NewLife.Remoting/Clients/ClientBase.cs b/NewLife.Remoting/Clients/ClientBase.cs
index 8f14da0..ad49a5e 100644
--- a/NewLife.Remoting/Clients/ClientBase.cs
+++ b/NewLife.Remoting/Clients/ClientBase.cs
@@ -262,7 +262,7 @@ class MyApiClient : ApiClient
{
public ClientBase Client { get; set; } = null!;
- protected override async Task
@@ -52,7 +53,7 @@
-
+
diff --git a/NewLife.Remoting/WsClient.cs b/NewLife.Remoting/WsClient.cs
index 4f03f2a..4209c63 100644
--- a/NewLife.Remoting/WsClient.cs
+++ b/NewLife.Remoting/WsClient.cs
@@ -243,10 +243,10 @@ public virtual Int32 InvokeOneWay(String action, Object? args = null, Byte flag
var codec = GetMessageCodec();
var context = new NetHandlerContext();
var pk = codec.Write(context, msg) as IPacket;
- await client.SendAsync(pk!.ToSegment(), WebSocketMessageType.Binary, true, default);
+ await client.SendAsync(pk!.ToSegment(), WebSocketMessageType.Binary, true, default).ConfigureAwait(false);
var buf = new Byte[64 * 1024];
- var data = await client.ReceiveAsync(new ArraySegment(buf), default);
+ var data = await client.ReceiveAsync(new ArraySegment(buf), default).ConfigureAwait(false);
rs = codec.Read(context, data) as IMessage;
if (rs == null) return default;
diff --git a/Test/Test.csproj b/Test/Test.csproj
index 79ea4e0..c3ac54f 100644
--- a/Test/Test.csproj
+++ b/Test/Test.csproj
@@ -10,7 +10,7 @@
-
+
diff --git a/XUnitTest/XUnitTest.csproj b/XUnitTest/XUnitTest.csproj
index c6d331e..67b1804 100644
--- a/XUnitTest/XUnitTest.csproj
+++ b/XUnitTest/XUnitTest.csproj
@@ -12,7 +12,7 @@
-
+