简体   繁体   English

IIS7中的文件安全性(IP地址访问限制)

[英]File Security (IP address access restrictions) in IIS7

I have a web service that contains 2 asmx files (public.asmx and private.asmx). 我有一个包含2个asmx文件的Web服务(public.asmx和private.asmx)。 On IIS6 I could go to the properties of private.asmx then, from the 'File Security' tab, deny all computers access except the IP address for localhost. 在IIS6上,我可以转到private.asmx的属性,然后从“文件安全性”选项卡中拒绝除localhost的IP地址之外的所有计算机访问。

In IIS7 I only seem to be able to do this for an entire folder. 在IIS7中,我似乎只能为整个文件夹执行此操作。 What am I missing? 我错过了什么?

Funny - I found this question because I have the same problem, but I think the solution is as follows: 搞笑 - 我发现这个问题因为我有同样的问题,但我认为解决方案如下:

  1. In IIS7, browse to the directory containing your public.asmx and private.asmx files. 在IIS7中,浏览到包含public.asmx和private.asmx文件的目录。
  2. The title at the top will reflect the current directory, like "WebService Home". 顶部的标题将反映当前目录,如“WebService Home”。 Click the "Content View" button at the bottom. 点击底部的“内容视图”按钮。
  3. Right-click on your public.asmx file and choose "Switch to Features View". 右键单击public.asmx文件,然后选择“切换到功能视图”。
  4. The title should be "public.asmx Home" to confirm that you're managing the one file. 标题应为“public.asmx Home”以确认您正在管理一个文件。
  5. Add your IP restrictions. 添加您的IP限制。 In this case, I think you want an Allow entry for 127.0.0.1 and choose "Edit Feature Settings" from the Action menu to Deny access to unspecified clients. 在这种情况下,我认为您需要127.0.0.1的允许条目,并从操作菜单中选择“编辑功能设置”以拒绝访问未指定的客户端。
  6. Click your containing folder again (eg WebService) and switch to Content View again to repeat these steps on private.asmx. 再次单击您包含的文件夹(例如WebService)并再次切换到Content View以在private.asmx上重复这些步骤。

I am learning the ropes of IIS7 myself, but I hope this answers your question. 我自己正在学习IIS7的绳索,但我希望这能回答你的问题。

Found this question via Google and was looking for how to do it via the .config file but could not find that answer here. 通过谷歌找到了这个问题,并且正在寻找如何通过.config文件来完成这个问题但是在这里找不到答案。 I've since tracked down the info: 我已经跟踪了这些信息:

The ipSecurity element is used by the web.config in IIS7 to restrict access by IP Address. IIS7中的web.config使用ipSecurity元素来限制IP地址的访问。 You can use it like this: 你可以像这样使用它:

<configuration>
    <location path="private.asmx">
        <system.webServer>
            <security>
                <ipSecurity>
                    <add ipAddress="192.168.100.1" />
                    <add ipAddress="169.254.0.0" subnetMask="255.255.0.0" />
                </ipSecurity>
            </security>
        </system.webServer>
    </location>
</configuration>

Update: Note that the role has to be added for this security to be enabled. 更新:请注意,必须添加角色才能启用此安全性。 See the ipSecurity article linked above. 请参阅上面链接的ipSecurity文章。

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

相关问题 我可以通过我的 ASP.NET 应用程序以编程方式将 IP 地址添加到 IIS7 中的动态 IP 限制扩展吗? - Can I programmatically add an IP address to Dynamic IP Restrictions extension in IIS7 from my ASP.NET app? IIS7 IPv4地址限制不在Web.Config中 - IIS7 IPv4 Address Restrictions not in Web.Config 通过Powershell在IIS中进行IP地址和域限制 - IP address and domain restrictions in iis through powershell IIS 10中的IP地址和域限制问题 - Issues with IP Address and Domain Restrictions in IIS 10 IIS IP地址限制子网掩码 - IIS IP Address restrictions subnet masks 如何使用IIS的IP地址和域限制来拒绝对MVC控制器方法的访问? - How do I use IIS' IP Address and Domain Restrictions to deny access to my MVC controller method? IIS7 或 ASP.NET 返回一个奇怪的客户端 IP 地址 - IIS7 or ASP.NET is returning an odd client IP Address 使用Netscaler的LoadBalanced应用程序的IIS -IP地址和域限制 - IIS -IP Address and Domain Restrictions for LoadBalanced app using Netscaler IIS-Windows Server 2012-IP地址和域限制 - IIS - Windows Server 2012 - IP Address and Domain Restrictions 如何在 IIS 到 PowerShell 中设置管理服务的 IP 地址限制? - How to set IP Address Restrictions for Management Service in IIS through PowerShell?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM