简体   繁体   English

使用带有IP地址的SignalR而不是计算机名称

[英]Use SignalR with IP Address instead of computer name

I have a SignalR service setup to run self hosted in a Windows Service. 我有一个SignalR服务设置,可以在Windows服务中运行自托管。

When I enter this address: 当我输入此地址时:

http://mycomputer.mydomain.net:8789/signalr/signalr/negotiate http://mycomputer.mydomain.net:8789/signalr/signalr/negotiate

I get some xml (for negotiation) displayed in the browser (showing that hit the service correctly.) 我在浏览器中显示了一些xml(用于协商)(显示正确命中了服务。)

But if I enter this address (that has mycomputer.mydomain.net 's ip address in place of the computer name): 但是如果我输入这个地址( mycomputer.mydomain.net的ip地址代替了计算机名):

http://10.92.15.6:8789/signalr/signalr/negotiate http://10.92.15.6:8789/signalr/signalr/negotiate

or this 或这个

http://localhost:8789/signalr/signalr/negotiate HTTP://本地主机:8789 / signalr / signalr /谈判

I get this error: 我收到此错误:

Bad Request - Invalid Hostname 错误请求 - 无效的主机名

HTTP Error 400. The request hostname is invalid. HTTP错误400.请求主机名无效。

I have tried also using: 我也尝试过使用:

http://10.92.15.6.mydomain.net:8789/signalr/signalr/negotiate http://10.92.15.6.mydomain.net:8789/signalr/signalr/negotiate

But I just get: 但我得到:

This site can't be reached 无法访问此网站

10.92.15.6.mydomain.net's server DNS address could not be found. 无法找到10.92.15.6.mydomain.net的服务器DNS地址。

Is there someway to be able to make SignalR work using an IP Address instead of the computer name? 有没有办法能够使用IP地址而不是计算机名使SignalR工作?

I had to change my startup from this: 我不得不改变我的创业公司:

string url = "http://" + machineName + ".mydomain.net:8789";
server = WebApp.Start<Startup>(url);

to this: 对此:

string url = "http://*:8789";
var startOptions = new StartOptions(url);
server = WebApp.Start<Startup>(startOptions);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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