使用 Sharpsvn 驱动程序进行颠覆身份验证

发布于 2024-12-29 01:50:26 字数 2803 浏览 2 评论 0原文

我已经按照以下步骤设置了我的颠覆服务器: http://www.codinghorror.com/blog/2008/04/setting-up-subversion-on-windows.html

服务器正在我的本地主机上运行

配置

这是我的配置文件:

anon-access = read
auth-access = write
password-db = passwd
authz-db = authz

authz:

[/]
* = w

passwd:

[users]
plorio = pass
test = pass

使用sharpSvn驱动程序的代码

var svn = new SvnClient();
svnClient.Authentication.DefaultCredentials = new NetworkCredential("test",
                                                                    "pass",
                                                                     new Uri("svn://localhost/main").AbsoluteUri);

var localFilename = "C:\\testFile.txt";
var commitArgs = new SvnCommitArgs();
commitArgs.LogMessage = "test";
svn.Commit(localFilename, commitArgs); // <<< error:

错误

svn.Commit(localFilename, commitArgs);给出以下错误:

提交失败(详细信息如下):

  • innerException:{“来自服务器的身份验证错误:未找到用户名”}
  • SvnErrorCode:SharpSvn.SvnErrorCode.SVN_ERR_RA_NOT_AUTHORIZED
  • SubversionErrorCode:<代码>170001
  • StackTrace:

    在 f:\qqn\sharpsvn-dist-1.6\src\sharpsvn\svnclientargs.cpp 中的 SharpSvn.SvnClientArgs.HandleResult(SvnClientContext 客户端,SvnException 错误):第 76 行 在 f:\qqn\sharpsvn-dist-1.6\src\sharpsvn\svnclientargs.cpp 中的 SharpSvn.SvnClientArgs.HandleResult(SvnClientContext 客户端,svn_error_t* 错误):第 42 行 在 f:\qqn\sharpsvn-dist-1.6\src\sharpsvn\commands\commit.cpp 中的 SharpSvn.SvnClient.Commit(ICollection`1 paths, SvnCommitArgs args, SvnCommitResult& result):第 136 行 在 f:\qqn\sharpsvn-dist-1.6\src\sharpsvn\commands\commit.cpp 中的 SharpSvn.SvnClient.Commit(字符串路径,SvnCommitArgs args):第 74 行 在C:\src\zod\ci-tests\SVN\WorkbookManagementService\WorkbookManagementOperations.cs中的Zephyr.OnDemand.WorkbookManagementService.WorkbookManagementOperations.UpdateWorkbook(字符串客户端,ManagedWorkbookDetails详细信息,流内容):第165行 在 C:\src\zod\ci-tests\SVN\Program.cs 中的 SVN.Program.Main(String[] args):第 24 行 在 System.AppDomain._nExecuteAssembly(程序集,String[] args) 在 System.AppDomain.ExecuteAssembly(字符串 assemblyFile,证据 assemblySecurity,字符串 [] args) 在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() 在 System.Threading.ThreadHelper.ThreadStart_Context(对象状态) 在 System.Threading.ExecutionContext.Run(ExecutionContextexecutionContext,ContextCallback 回调,对象状态) 在 System.Threading.ThreadHelper.ThreadStart()

我相当有信心颠覆配置或 svnClient.Authentication.DefaultCredentials 中存在错误,如果有人有任何想法会有所帮助。提前致谢。

I've set up my subversion server following the steps on : http://www.codinghorror.com/blog/2008/04/setting-up-subversion-on-windows.html

The server is running on my localhost

Configurations

this is my config file:

anon-access = read
auth-access = write
password-db = passwd
authz-db = authz

authz:

[/]
* = w

passwd:

[users]
plorio = pass
test = pass

Code using sharpSvn driver

var svn = new SvnClient();
svnClient.Authentication.DefaultCredentials = new NetworkCredential("test",
                                                                    "pass",
                                                                     new Uri("svn://localhost/main").AbsoluteUri);

var localFilename = "C:\\testFile.txt";
var commitArgs = new SvnCommitArgs();
commitArgs.LogMessage = "test";
svn.Commit(localFilename, commitArgs); // <<< error:

Error

svn.Commit(localFilename, commitArgs); gives the following error:

Commit failed (details follow):

  • innerException : {"Authentication error from server: Username not found"}
  • SvnErrorCode : SharpSvn.SvnErrorCode.SVN_ERR_RA_NOT_AUTHORIZED
  • SubversionErrorCode : 170001
  • StackTrace :

    at SharpSvn.SvnClientArgs.HandleResult(SvnClientContext client, SvnException error) in f:\qqn\sharpsvn-dist-1.6\src\sharpsvn\svnclientargs.cpp:line 76
    at SharpSvn.SvnClientArgs.HandleResult(SvnClientContext client, svn_error_t* error) in f:\qqn\sharpsvn-dist-1.6\src\sharpsvn\svnclientargs.cpp:line 42
    at SharpSvn.SvnClient.Commit(ICollection`1 paths, SvnCommitArgs args, SvnCommitResult& result) in f:\qqn\sharpsvn-dist-1.6\src\sharpsvn\commands\commit.cpp:line 136
    at SharpSvn.SvnClient.Commit(String path, SvnCommitArgs args) in f:\qqn\sharpsvn-dist-1.6\src\sharpsvn\commands\commit.cpp:line 74
    at Zephyr.OnDemand.WorkbookManagementService.WorkbookManagementOperations.UpdateWorkbook(String client, ManagedWorkbookDetails details, Stream content) in C:\src\zod\ci-tests\SVN\WorkbookManagementService\WorkbookManagementOperations.cs:line 165
    at SVN.Program.Main(String[] args) in C:\src\zod\ci-tests\SVN\Program.cs:line 24
    at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
    at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
    at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
    at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
    at System.Threading.ThreadHelper.ThreadStart()

I am fairly confident the error exists in the subversion configuration or the svnClient.Authentication.DefaultCredentials if anyone has any ideas it would be helpful. Thanks in advance.

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

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

发布评论

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

评论(1

飘落散花 2025-01-05 01:50:26

问题
我正在从另一个 Subversion 工作目录复制我的工作目录。这是有问题的,因为我也被复制到了 .svn 文件夹。这导致程序尝试提交到 .svn 文件夹中定义的服务器,从而导致身份验证错误。

解决方案
从工作目录中删除 .svn 文件夹并重新添加和提交文件

Problem
I was copying over my working directory from another Subversion working directory. This was problematic because I was also copied over the .svn folders. This caused the program to try and commit to the server defined in the .svn folder, which rendered the authentication error.

Solution
Delete .svn folders from working directory and re add and commit files

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