将 asmx Web 服务的访问限制为特定 IP 地址

发布于 2024-07-26 04:55:00 字数 121 浏览 1 评论 0原文

我需要将对 .asmx Web 服务的访问限制为特定 IP 地址。 我想我可以在每个方法中添加硬编码检查,但这似乎是代码维护的噩梦。 是否有可以创建的 Web 配置条目,或者可以应用于 .asmx 文件的 IIS 6 设置?

I need to limit access of an .asmx web service to specific IP addresses. I figure I could add a hardcoded check into each method, but that seems like a code maintenance nightmare. Is there a web configuration entry I can make, or a IIS 6 setting I can apply to the .asmx file?

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

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

发布评论

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

评论(2

留一抹残留的笑 2024-08-02 04:55:00

在 IIS 6.0 管理器中,右键单击 .asmx 文件。

转到“文件安全”选项卡,然后单击“IP 地址和域名限制”中的“编辑”按钮。

单击“拒绝访问”单选按钮,然后将列入白名单的 IP 地址添加到列表中。

对于 IIS 7.5,这有点棘手,因为该文件不会显示在导航面板中。 您需要转到“内容视图”选项卡(位于窗口的下部),右键单击您的文件并选择“切换到功能视图”。 打开IP地址和域限制,单击编辑功能设置并选择拒绝未指定的主机。 现在您可以通过单击添加允许条目来添加授权。

In IIS 6.0 Manager, right click on the .asmx file.

Go to the File Security tab, and Click the Edit button in the IP Address and domain name restrictions.

Click the 'Denied Access' radio button, then add your whitelisted ip addresses to the list.

For IIS 7.5, it's a little tricky as the file doesn't show in the navigation panel. You need to go to the Content View tab (in the lower part of the window), right click on your file and choose Switch to Features View. Open IP Address and Domain Restriction, click on Edit Feature Settings and choose to deny unspecified hosts. Now you can add authorizations by clicking on Add Allow Entry.

神回复 2024-08-02 04:55:00

将自定义部分添加到 web.config,然后查询该部分的 IP 地址白名单。

Add a custom section to your web.config, and then query that section for the whitelist of IP addresses.

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