我从 SignalR 客户端应用程序连接到 SignalRHub 时遇到问题,下面给出的是错误日志-
info: Microsoft.AspNetCore.Sockets.Client.WebSocketsTransport[0]
02/01/2018 15:20:13: Connection Id f763a939-3fb9-4812-ae6e-dfe3198ab37b: Starting transport. Transfer mode: Text.
fail: Microsoft.AspNetCore.Sockets.Client.HttpConnection[9]02/01/2018 15:20:13: Connection Id f763a939-3fb9-4812-ae6e-dfe3198ab37b: Failed to start connection. Error starting transport 'WebSocketsTransport'.
System.Net.WebSockets.WebSocketException (0x80004005): Unable to connect to the remote server ---> System.Net.WebException: The remote server returned an error: (404) Not Found.
at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task …Run Code Online (Sandbox Code Playgroud) stateless websocket signalr azure-service-fabric asp.net-core-mvc-2.0
我想通过 Signalr 传递附加参数而不进行任何重大更改。
正在使用的 SignalR 集线器 web api 端信号器 nuget 包是“Microsoft.AspNetCore.SignalR”版本=“1.0.3”。正在使用的客户端 nuget 包是 "Microsoft.AspNetCore.SignalR.Client" Version="1.0.3" />
信号器集线器 web api 端的初始代码如下-
public async Task<bool> SendResponse(string uniqueId, string param1, string param2, string param3, string param4, string param5, string param6)
{
await HubContext.Clients.Group(uniqueId).SendAsync("SendResponse", param1, param2, param3, param4, param5,param6);
return true;
}
Run Code Online (Sandbox Code Playgroud)
客户端的初始代码-
Connection.On<string, string, string, string, string, string>("SendResponse",
async (param1, param2, param3, param4, param5, param6) =>
{
//code here.
});
Run Code Online (Sandbox Code Playgroud)
当他想要更新 nuget 包时,此客户端代码通过 nuget 包和它的应用程序所有者与所有人共享。
直到现在一切正常,出现了一个改变的需求(传递一个带有响应的新参数)。
为了满足这个要求,我在下面给出了信号集线器端的代码更改 -
public async Task<bool> SendResponse(string uniqueId, …Run Code Online (Sandbox Code Playgroud) 我正在开发一个应用程序,在其中使用 WinSCP .NET 程序集(版本 5.5.0.3839)下载文件
我下载文件的代码如下
public bool ReceiveFile(string ftpFilePath,out String downloadedFileName, String DestinationPath)
{
bool sendingStatus = false;
downloadedFileName = string.Empty;
try
{
if (sessionOptions != null)
{
using (Session session = new Session())
{
// Connect
bool isSessionOpened = OpenSession(session);
if (isSessionOpened)
{
// Upload files
TransferOptions transferOptions = new TransferOptions();
transferOptions.TransferMode = TransferMode.Automatic;
TransferOperationResult transferResult;
transferResult = session.GetFiles(ftpFilePath, DestinationPath, false, transferOptions);
// Throw on any error
transferResult.Check();
// Print results
foreach (TransferEventArgs transfer in transferResult.Transfers)
{
sendingStatus …Run Code Online (Sandbox Code Playgroud) c# ×2
signalr ×2
asp.net-core ×1
public-key ×1
sftp ×1
stateless ×1
websocket ×1
winscp ×1
winscp-net ×1