"http://localhost:8080"또는 http://127.0.0.1:8080/에 연결할 수 있지만 로컬 IP 주소를 연결할 수없는 SignalR 서버 및 클라이언트 아키텍처를 만들려고합니다. "192. xxx"와 같은 이유가 무엇일까요? ... 나는 또한 내 코드 overhere를 배치하고 저를 도와주세요SignalR : 로컬 또는 다른 IP 주소에 연결할 수 없습니다.
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();
}
}
}
감사합니다. 동일한 문제가 있었지만 해결되었습니다. – drgmak
미안하지만 나에게 똑같은 문제가있다. –
나는 샘플을 가지고있다. https://code.msdn.microsoft.com/windowsdesktop/Using-SignalR-in-WinForms-f1ec847b –