如何保护 ASP.NET Web 服务仅允许相对路径调用?

发布于 2024-09-02 00:22:15 字数 90 浏览 2 评论 0原文

我的 Web 应用程序有 ASMX 服务,我只希望该服务可用于同一应用程序。

有没有办法让Web服务只能被同一个应用程序访问,例如相对/绝对路径限制?

I have ASMX services for my web application that I would only like available to the same application.

Is there a way for the web service to only be accessible by the same application, such as relative/absolute path restrictions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

呆萌少年 2024-09-09 00:22:15

最简单的方法就是不使用网络服务。如果您从同一个应用程序进行调用,您可能只需将逻辑提取到一个单独的类中,然后直接在代码中调用它,而不是通过 Web 服务。

The easiest route would be to just not use a web service. If you're calling from the same application, you can probably just pull your logic into a separate class, and call it directly in your code, not via web service.

扮仙女 2024-09-09 00:22:15

有两种方法可以实现此目的:

  • 将 Web 服务托管在不同的机器上。主 Web 框位于可公开访问的 IP 上(即在 DMZ 中),而 Web 服务框只能访问内部网络。
  • 通过足够的网络体操,你也许能够做到这一点。例如,将 Web 服务托管在同一机器上但 IP 不同,并让防火墙阻止对该 IP 的任何外部调用。

Two ways to do this:

  • Have the web services hosted on a different box. The main web box is on a publicly accessible IP (ie. in the DMZ), while the web service box is only accessible to the internal network.
  • You might be able to do this with sufficient networking gymnastics. For example, host the web services on the same box but a different IP, and have the firewall block any outside calls to that IP.
韶华倾负 2024-09-09 00:22:15

Web 服务可以由各种代码调用,而不仅仅是网站一部分的代码。因此,一般来说,不存在“调用 URL”。

Web services can be called by all sorts of code, not just code that's part of a web site. So, in general, there is no "calling URL".

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文