【问题标题】:Set write permissions for my program to folder access将我的程序的写入权限设置为文件夹访问
【发布时间】:2013-01-11 06:36:32
【问题描述】:

我在 Visual Studio 中构建了一个程序。该程序创建一个日志文件并在程序通过 log4net 运行时写入其中。因此,无论哪个用户使用该程序,我都应该为我的程序文件夹设置写权限。

当我访问我的应用程序时,它会抛出错误

文件访问被拒绝

所以我做了什么,我在那里给了 iis_users 管理员权限,它工作正常......

但我的问题是没有设置我应该能够通过 iis 运行我的应用程序的权限

所以我已经完成了

1) 创建 app.manifest 文件,代码为

 <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
        <!-- UAC Manifest Options
            If you want to change the Windows User Account Control level replace the 
            requestedExecutionLevel node with one of the following.

        <requestedExecutionLevel  level="asInvoker" uiAccess="false" />
        <requestedExecutionLevel  level="requireAdministrator" uiAccess="false" />
        <requestedExecutionLevel  level="highestAvailable" uiAccess="false" />

            Specifying requestedExecutionLevel node will disable file and registry virtualization.
            If you want to utilize File and Registry Virtualization for backward 
            compatibility then delete the requestedExecutionLevel node.
        -->
         <requestedExecutionLevel  level="asInvoker" uiAccess="false" />
        <requestedExecutionLevel  level="requireAdministrator" uiAccess="false" />
        <requestedExecutionLevel  level="highestAvailable" uiAccess="false" />

      </requestedPrivileges>

但这并不能帮助我解决这个问题

【问题讨论】:

  • 您可能应该评论您的应用程序与 IIS 的关系。很明显,您不是在谈论网站/ASP.net 或网站上使用的程序集。另一方面,您声明“通过 IIS 运行我的应用程序”,这意味着某种关系......

标签: c# .net security


【解决方案1】:

首先,您不应该这样做 - 我的意思是,将日志写入您的程序文件夹。这就是 TEMP 文件夹的用途。

也就是说,我认为为程序文件夹中的文件设置权限的一种方法是在设置的自定义操作中进行。

这里有一个类似的问题:How to give Read/Write permissions to a Folder during installation using .NET

【讨论】:

    猜你喜欢
    • 2018-08-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-13
    • 2015-01-24
    • 2011-12-14
    • 2011-08-21
    相关资源
    最近更新 更多