简体   繁体   中英

Print to console in SignalR Hub

I try to use SignalR, everything works fine except I can't print to console (in visual studio).

Here's the code on server:

public class GateSignalr : Hub
{
    public void send(string state) {
        Console.WriteLine("send executed: ");
        Console.WriteLine(state);
        Clients.All.receiveState(state);
    }
}

i call method send in the server from client, and it work fine, because the server also call method receiveState in client

but its not print to console

i already look in visual studio output panel, and make it show output from : Build , Build Order , Debug , Javascript Language Service , Package Manager .

but its not there

i'm expecting console to print "send executed: "

or maybe it print in somewhere else?

Console.WriteLine will only print content in a console application. To print in visual studio output, you need to use Trace.WriteLine or Debug.WriteLine (if you use the Debug configuration which by default defines the DEBUG constant).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM