Ich versuche SignalR Server- und Client-Architektur zu machen, in der ich eine Verbindung zu "http://localhost:8080" oder http://127.0.0.1:8080/ herstellen kann, aber ich kann meine lokale IP-Adresse nicht verbinden wie "192. xxx" also was könnte Grund sein? bitte helfen Sie mir, ich bin auch platzieren meinen Code over ...SignalR: kann keine Verbindung zu lokalen oder einer anderen IP-Adresse herstellen
public partial class WinFormsServer : Form
{
private IDisposable SignalR { get; set; }
const string ServerURI = "http://localhost:8080";
private void ButtonStart_Click(object sender, EventArgs e)
{
WriteToConsole("Starting server...");
ButtonStart.Enabled = false;
Task.Run(() => StartServer());
}
private void StartServer()
{
try
{
SignalR = WebApp.Start(ServerURI);
}
catch (TargetInvocationException)
{
WriteToConsole("Server failed to start. A server is already running on " + ServerURI);
//Re-enable button to let user try to start server again
this.Invoke((Action)(() => ButtonStart.Enabled = true));
return;
}
this.Invoke((Action)(() => ButtonStop.Enabled = true));
WriteToConsole("Server started at " + ServerURI);
}
class Startup
{
public void Configuration(IAppBuilder app)
{
app.UseCors(CorsOptions.AllowAll);
app.MapSignalR();
}
}
}
Danke, ich hatte das gleiche Problem und das hat es gelöst. – drgmak
Entschuldigung, aber für mich bin ich mit dem gleichen Problem konfrontiert –
Ich habe die Probe overhere https://code.msdn.microsoft.com/windowsdesktop/Using-SignalR-in-WinForms-f1ec847b –