如何解决C#SelfHost如何限制所有外部请求?
我有一个用作后台服务的程序。它托管一个自托管服务。但是有一个问题。当我托管此服务时,它可用于所有区域设置网络。而且,同一网络中的每个人都可以访问此API。 这是我托管服务的方式:
首先,我向netsh注册该网址
_launchMaps(double lat,double lon) async {
String googleUrl =
'comgooglemaps://?center=${lat},${lon}';
String appleUrl =
'https://www.google.com/maps/search/?api=1&query=$lat,$lon';
if (await canLaunch("comgooglemaps://")) {
print('launching com googleUrl');
await launch(googleUrl);
} else if (await canLaunch(appleUrl)) {
print('launching apple url');
await launch(appleUrl);
} else {
throw 'Could not launch url';
}
}
然后我托管服务
<key>LSApplicationQueriesSchemes</key>
<array>
<string>googlechromes</string>
<string>comgooglemaps</string>
</array>
ExtendHttpSelfHostConfiguration 的结构为:
Android
它完全适用于本地计算机。
但是当我扫描网络时,nmap可以检测到该端口。
问题在于如何使其仅在计算机上工作。其他人不应访问此端口。 据我了解,这样做应该 0.0.0.0 ,而不是 127.0.0.1 。
我该如何解决这个问题?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。