Self-hosting ServiceStack REST Service on local network

点点圈 提交于 2019-12-10 18:42:32

问题


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?

Any help is much appreciated!

Some of the code samples (My AppHost class is inheriting from the AppHostHttpListenerBase)

restServiceToStart.Value.Init ();
restServiceToStart.Value.Start (_HostUri);

where for my main machine, the _HostUri is set to "http://my-ip-address:8080/"


回答1:


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.



来源:https://stackoverflow.com/questions/15888834/self-hosting-servicestack-rest-service-on-local-network

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!