AnkhSVN 破坏了 ASP.NET 与 SVN 1.7 的共享权限

发布于 2024-12-28 06:50:29 字数 1508 浏览 1 评论 0原文

背景(如果你想问这个问题,请跳到底部)

最近我将 SVN 存储库(托管在 assembla 上)升级到 SVN 1.7。这样做之后,我们开始在存储库本地工作副本中的 ASP.NET 站点页面上间歇性地遇到大量文件访问被拒绝错误。

一些文件夹也开始获得奇怪的文件权限(它们被标记为只读),并且用户共享被删除。这些问题只会在更新/提交周期后通过 AnkhSVN 的 Visual Studio 插件开始出现,但并非总是如此;看上去脾气暴躁。

到目前为止,我们发现的唯一临时修复是提交所有未完成的更改,删除本地副本并重新签出完整的工作副本(使用 TortoiseSVN)。然而,这不是一个可行的解决方案,并且严重影响了生产力。

此站点是基于 Azure 的 ASP.NET WebWorkerRole。在升级到SVN 1.7之前从未出现过问题。我尝试修改内部 IIS 权限来解决这个问题,但是没有成功。

我的环境

  • Visual Studio 2010 Ultimate 10.0.40219.1 SP1
  • AnkhSVN 2.3.10509(最新版本,支持 SVN 1.7.1)
  • TortoiseSVN 1.7.1,Build 22161 - 64 位
  • 通过 Azure 模拟器环境在调试模式下运行

问题

SVN 1.7 或任何版本是否可以我的环境中有哪些工具可以破坏文件权限,从而使文件在 ASP.NET 站点中变得无法使用?更重要的是,我该如何解决这个问题?


转储的确切文件权限错误是这样的:

对路径“//file//”的访问被拒绝。

描述:执行期间发生未处理的异常 当前的网络请求。请查看堆栈跟踪以了解更多信息 有关错误及其在代码中的来源的信息。

异常详细信息:System.UnauthorizedAccessException:访问 路径“//file//”被拒绝。

ASP.NET 无权访问所请求的资源。考虑 向 ASP.NET 请求授予资源访问权限 身份。 ASP.NET 有一个基本进程标识(通常是 IIS 5 上的 {MACHINE}\ASPNET 或 IIS 6 和 IIS 7 上的网络服务,以及 在 IIS 7.5 上配置的应用程序池标识),如果 该应用程序不是冒充的。如果应用程序是 冒充 via ,身份将是 匿名用户(通常为 IUSR_MACHINENAME)或经过身份验证的用户 请求用户。

要授予 ASP.NET 对文件的访问权限,请在资源管理器中右键单击该文件, 选择“属性”并选择“安全”选项卡。点击“添加”进行添加 适当的用户或组。突出显示 ASP.NET 帐户,然后 选中所需访问权限的复选框。

但干净的工作副本不会生成此错误。比较两者的权限,似乎没有被窃听的工作副本是共享的(与IUSR和本地帐户),而被破坏的工作副本的共享为零,但用户从未更改过共享。

The Background (skip to the bottom if you want the question)

Recently I upgraded an SVN repository (hosted on assembla) to SVN 1.7. After doing so, we started to intermittently encounter lots of File Access Denied errors on the ASP.NET site pages that sit in the local working copy of the repository.

Some folders also started to get weird file permissions (they became marked read-only) and user sharing got removed from them. These problems would only start occurring after an update/commit cycle, via AnkhSVN's Visual Studio plugin, but not all the time; it seemed highly temperamental.

The only temp-fix we've found so far is to commit any outstanding changes, delete the local copy and re-checkout a full working copy (with TortoiseSVN). However, that is not a viable fix, and it is seriously impacting on productivity.

This site is an Azure based ASP.NET WebWorkerRole. It has never given problems before the upgrade to SVN 1.7. I tried fiddling with the internal IIS permissions to get around the problem, however, no dice.

My Environment

  • Visual Studio 2010 Ultimate 10.0.40219.1 SP1
  • AnkhSVN 2.3.10509 (latest version, supports SVN 1.7.1)
  • TortoiseSVN 1.7.1, Build 22161 - 64 Bit
  • Running in Debug Mode via the Azure emulator environment

The Question

Is it possible for SVN 1.7 or any of the tools in my environment to break file permissions so that the files become unusable in an ASP.NET site? and more importantly, how do I fix this?


The exact file permission error dumped out is this:

Access to the path '//file//' is denied.

Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.UnauthorizedAccessException: Access to the
path '//file//' is denied.

ASP.NET is not authorized to access the requested resource. Consider
granting access rights to the resource to the ASP.NET request
identity. ASP.NET has a base process identity (typically
{MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6 and IIS 7, and
the configured application pool identity on IIS 7.5) that is used if
the application is not impersonating. If the application is
impersonating via , the identity will be
the anonymous user (typically IUSR_MACHINENAME) or the authenticated
request user.

To grant ASP.NET access to a file, right-click the file in Explorer,
choose "Properties" and select the Security tab. Click "Add" to add
the appropriate user or group. Highlight the ASP.NET account, and
check the boxes for the desired access.

But a clean working copy will not generate this error. Comparing the permissions of the two, it seems the working copies that are not bugged are shared (with IUSR and the local account), whereas the broken ones have zero sharing, yet the sharing is never changed by the user.

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

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

发布评论

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

评论(4

薆情海 2025-01-04 06:50:29

当 Subversion 更新文件时,它首先在 .svn/tmp/ 中创建一个临时版本。然后它将文件移动到正确的位置。 (这是为了避免损坏)

在 1.6 中,它单独对每个目录执行此操作,但在 1.7 中,工作副本的顶级目录中只有一个 .svn。

如果以某种方式限制此 .svn 目录的文件系统权限,则当文件移动到位时,这些限制可能会随文件一起复制。
(Subversion 不会更改 Windows 上的权限本身)

When subversion updates a file it first creates a temporary version in .svn/tmp/. It then moves the file into the right location. (This to avoid corruptions)

In 1.6 it did this for every directory by itself, but in 1.7 there is just a .svn in the top level directory of your working copy.

If somehow the filesystem permissions of this .svn directory are restricted, it is possible that the restrictions are copied with the file when it is moved in place.
(Subversion doesn't change the permissions itself on Windows)

南冥有猫 2025-01-04 06:50:29

我通过访问网站文件夹的安全设置并单击“高级”,然后单击“更改 IIS_IUSRS 用户的权限”解决了此问题。我选中“用该对象的可继承权限替换所有子对象权限”,然后单击“应用”。

在此之前,我已授予 IIS 用户对结账根目录中隐藏的 tmp 文件夹的完全权限,但我不知道这是否有帮助。

我不确定这是否是永久修复,但如果不是,您至少可以使用它在单个操作中重新应用所有文件的权限。

I solved this by accessing the security settings for the website folder and and clicking Advanced and then Change Permissions for the IIS_IUSRS user. I checked the "Replace all child object permissions with inheritable permissions from this object" and clicked apply.

Before that, I had given the IIS user full permissions to the hidden tmp folder in the root of the checkout, but I don't know if this helps with anything.

I'm not sure if this is a permanent fix, but in case it is not, you can at least use it to reapply permissions for all the files in a single operation.

千紇 2025-01-04 06:50:29

许多信息位于项目签出目录内的 .svn 文件夹中。所以我认为最好将 SVN 与高级集成工具分开使用。还有这个< /a> 处理解决这样的问题。

Much information is located in .svn folders inside directory where project was checked out. So in my opinion better use SVN separately from advanced integration tools. Also this deals with solving problem like this.

嘿咻 2025-01-04 06:50:29

进行“恢复”时,我发现发生了完全相同的问题

  • 当我使用Tortoise Svn 1.6.16
  • AnkhSVN 2.3.11269.1348
  • 。 Visual Studio 2010 专业版
  • Windows 7 - 64 位。

当我第一次遇到权限错误时,我完全感到困惑,并开始认为这是我的代码。经过一段时间的摆弄后,我最终删除了整个项目并从 Subversion 重新下载,这解决了问题。

当这个问题再次发生时,我更仔细地查看了恢复的文件,发现恢复的文件的权限与其他文件的权限不匹配。特别是对于运行 Visual Studio 的计算机,完全缺少“用户”权限。

所以我只是通过以下方式添加它:

  • 右键单击问题文件。这导致文件属性窗口出现。
  • 然后单击“编辑...”。出现权限窗口。
  • 然后单击“添加”,将出现“选择用户、计算机、服务帐户或组”窗口。
  • 单击“对象类型”按钮并选中所有复选框。
  • 单击“位置”按钮并确保选择了您的计算机名称。
  • 输入“用户”,然后单击“检查名称”按钮。
  • 单击所有窗口上的确定将其关闭。

您的网站现在应该可以正常运行,不会出现权限错误。

I found this exact same issue happened when I did a 'Revert' using:

  • Tortoise Svn 1.6.16
  • AnkhSVN 2.3.11269.1348.
  • Visual Studio 2010 Professional
  • Windows 7 - 64 bit.

I was completely puzzled the first time I encountered the permissions error and started off by thinking it was my code. After a while of fiddling about I ended up deleting the whole project and re-downloading from Subversion which fixed the issue.

When this problem happened again I looked more closely at the reverted file, and I found the permissions on the reverted files do not match the permissions of the other files. Specifically 'Users' permissions, for the machine that Visual Studio is running on, is missing altogether.

So I just added it in by:

  • Right clicking on the problem file. This caused the file properties window to appear.
  • Then clicked on 'Edit...'. The permission window appears.
  • Then clicked on Add and the 'Select Users, Computers, Service Accounts, or Groups window appears.
  • Click on the Object Types button and check all the boxes.
  • Click on the Locations button and make sure your machine name is selected.
  • Type in 'users' then click the 'check names' button.
  • Click OK on all the windows to close them.

Your website should now run without the permissions error.

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