Perforce API (P4API.NET): P4Exception: 尝试获取锁的次数太多 p4tickets.txt.lck
Perforce API (P4API.NET): P4Exception: Too many trys to get lock p4tickets.txt.lck
我编写了一个 .NET Web 应用程序来建立 Perforce 连接,但一直收到以下错误消息。只有当我发布到服务器时才会出现此问题。当我 运行 这个应用程序在本地机器上运行时,它工作得很好,但在服务器上,当我尝试登录时,它看起来总是失败。
[P4Exception: Fatal client error; disconnecting! Operation
'client-SetPassword' failed. Too many trys to get lock
C:\WINDOWS\system32\config\systemprofile\p4tickets.txt.lck. ]
Perforce.P4.P4Exception.Throw(String cmd, String[] args,
P4ClientErrorList errors, P4ClientInfoMessageList details) in
c:\tmp4564385\P4.NET\r19.2\p4api.net\p4api.net\P4Exception.cs:393
Perforce.P4.P4Server.RunCommand(String cmd, UInt32 cmdId, Boolean
tagged, String[] args, Int32 argc) in
c:\tmp4564385\P4.NET\r19.2\p4api.net\p4api.net\P4Server.cs:1106
Perforce.P4.P4Command.RunInt(StringList flags) in
c:\tmp4564385\P4.NET\r19.2\p4api.net\p4api.net\P4Command.cs:503
Perforce.P4.P4CommandResult..ctor(P4Command cmd, StringList flags) in
c:\tmp4564385\P4.NET\r19.2\p4api.net\p4api.net\P4CommandResult.cs:142
Perforce.P4.P4Command.Run(StringList flags) in
c:\tmp4564385\P4.NET\r19.2\p4api.net\p4api.net\P4Command.cs:373
Perforce.P4.Connection.Login(String password, Boolean allHostTicket)
in
c:\tmp4564385\P4.NET\r19.2\p4api.net\p4api.net\Connection.cs:1071
这是我 connect/login
的部分代码
private void Connect(Connection con)
{
con.UserName = username;
if (con.Client == null)
{
con.Client = new Client();
con.Client.Name = "";
}
con.Connect(null);
con.Login(password);
}
我也一直在尝试使用 P4.Option 并将密码存储在此处并将其作为参数传递给 con.Connect() 而不是使用 con.Login() 但它有同样的问题(仅当我发布到服务器时。)
有人可以帮忙解决这个问题吗?
这看起来像是服务器文件系统上的权限问题。默认情况下,登录票进入 %USERPROFILE%/p4tickets
。您的应用程序是 运行 作为 System
用户,它没有正常的 Users
目录,因此它试图将其票据写入系统文件夹(该应用程序实际上可能没有有写入权限)。
通常我会通过使用 p4 login -p
来解决这个问题,以避免在实际文件系统上需要票证文件。另一个可能的修复方法是将票据文件位置显式设置为您确定可写的路径。
我编写了一个 .NET Web 应用程序来建立 Perforce 连接,但一直收到以下错误消息。只有当我发布到服务器时才会出现此问题。当我 运行 这个应用程序在本地机器上运行时,它工作得很好,但在服务器上,当我尝试登录时,它看起来总是失败。
[P4Exception: Fatal client error; disconnecting! Operation 'client-SetPassword' failed. Too many trys to get lock C:\WINDOWS\system32\config\systemprofile\p4tickets.txt.lck. ]
Perforce.P4.P4Exception.Throw(String cmd, String[] args, P4ClientErrorList errors, P4ClientInfoMessageList details) in c:\tmp4564385\P4.NET\r19.2\p4api.net\p4api.net\P4Exception.cs:393
Perforce.P4.P4Server.RunCommand(String cmd, UInt32 cmdId, Boolean tagged, String[] args, Int32 argc) in c:\tmp4564385\P4.NET\r19.2\p4api.net\p4api.net\P4Server.cs:1106
Perforce.P4.P4Command.RunInt(StringList flags) in c:\tmp4564385\P4.NET\r19.2\p4api.net\p4api.net\P4Command.cs:503
Perforce.P4.P4CommandResult..ctor(P4Command cmd, StringList flags) in c:\tmp4564385\P4.NET\r19.2\p4api.net\p4api.net\P4CommandResult.cs:142 Perforce.P4.P4Command.Run(StringList flags) in c:\tmp4564385\P4.NET\r19.2\p4api.net\p4api.net\P4Command.cs:373
Perforce.P4.Connection.Login(String password, Boolean allHostTicket) in c:\tmp4564385\P4.NET\r19.2\p4api.net\p4api.net\Connection.cs:1071
这是我 connect/login
的部分代码 private void Connect(Connection con)
{
con.UserName = username;
if (con.Client == null)
{
con.Client = new Client();
con.Client.Name = "";
}
con.Connect(null);
con.Login(password);
}
我也一直在尝试使用 P4.Option 并将密码存储在此处并将其作为参数传递给 con.Connect() 而不是使用 con.Login() 但它有同样的问题(仅当我发布到服务器时。)
有人可以帮忙解决这个问题吗?
这看起来像是服务器文件系统上的权限问题。默认情况下,登录票进入 %USERPROFILE%/p4tickets
。您的应用程序是 运行 作为 System
用户,它没有正常的 Users
目录,因此它试图将其票据写入系统文件夹(该应用程序实际上可能没有有写入权限)。
通常我会通过使用 p4 login -p
来解决这个问题,以避免在实际文件系统上需要票证文件。另一个可能的修复方法是将票据文件位置显式设置为您确定可写的路径。