简体   繁体   English

在本地网络上自托管ServiceStack REST服务

[英]Self-hosting ServiceStack REST Service on local network

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. 我想知道是否有人可以提供帮助 - 我有一个本地网络(无线,我的电脑和连接到它的笔记本电脑),我尝试在其上托管使用ServiceStack开发的休息服务。 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. 如果我在计算机上运行应用程序(现在是一个控制台应用程序)并尝试使用机器IP或127.0.0.1访问该服务,它工作正常 - 但如果我尝试从笔记本电脑访问它,使用计算机的IP它只是停顿,从不调用REST服务。

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) 一些代码示例(My AppHost类继承自AppHostHttpListenerBase)

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

where for my main machine, the _HostUri is set to "http://my-ip-address:8080/" 对于我的主机,_HostUri设置为"http://my-ip-address:8080/"

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}/ , eg from the Self Hosting wiki : 您没有列出用于启动AppHost的代码(在提问时请说明)所以我假设您没有收听http://*:{port}/ ,例如来自Self Hosting维基

var appHost = new AppHost();
appHost.Init();
appHost.Start("http://*:1337/");

The * wildcard says to listen on every local network interface. *通配符表示要侦听每个本地网络接口。

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

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