自托管的本地网络上ServiceStack REST服务 [英] Self-hosting ServiceStack REST Service on local network
问题描述
我想知道是否有人能帮助 - 我有一个本地网络(无线,我的电脑和连接到一台笔记本电脑),我已经试过与托管在ServiceStack它开发一个REST服务。如果我在计算机上运行应用程序(目前一个控制台应用程序),并尝试使用该机器的IP来访问服务或127.0.0.1它工作正常 - 但如果我尝试从笔记本电脑访问它,使用计算机的IP它只是摊位和REST服务没有被调用。
I was wondering if anyone could help - I have a local network (wireless, my computer and a laptop connected to it) and I've tried hosting a rest service developed with ServiceStack on it. If I run the application on the computer (a console app for now) and try to access the service using the machine IP or 127.0.0.1 it works fine - but if I try and access it from the laptop, using the computer's IP it simply stalls, and the REST service is never called.
我试过关掉所有的防火墙等等,一切都运行在管理员模式下,但仍然没有..我失去了一些东西简单得到这个工作?
I've tried turning off all firewalls etc, running everything in Admin mode but still nothing.. am I missing something simple to get this working?
任何帮助深表感谢!
一些代码示例(我APPHOST类从AppHostHttpListenerBase继承)
Some of the code samples (My AppHost class is inheriting from the AppHostHttpListenerBase)
restServiceToStart.Value.Init ();
restServiceToStart.Value.Start (_HostUri);
在这里为我的主要机,_HostUri设置为的http:/ /我-IP地址:8080 /
推荐答案
您还没有上市,你的代码用它来启动你的APPHOST(请在提问的时候是描述性的),所以我会假设你不听的http:// *:{端口} /
,例如从自托管维基:
You haven't listed the code you use to start your AppHost (please be descriptive when asking questions) so I'm going to assume you're not listening to http://*:{port}/
, e.g. from the Self Hosting wiki:
var appHost = new AppHost();
appHost.Init();
appHost.Start("http://*:1337/");
的
*
通配符说,听每个本地网络接口
The *
wildcard says to listen on every local network interface.
这篇关于自托管的本地网络上ServiceStack REST服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!