Asp.net web api 用于创建webapi的p4api.net.dll

Asp.net web api 用于创建webapi的p4api.net.dll,asp.net-web-api,perforce,p4api.net,Asp.net Web Api,Perforce,P4api.net,因此,我创建了这个web应用程序,它将调用服务器以获取有关分支、流、changset信息等的信息。我正在使用p4api.net.dll创建api。我已经下载并解压缩了它,并按照perforce页面上的说明将其连接到服务器 **Problem** Using C# and P4API.NET, how to I create a basic program to connect and disconnect from the server? **Solution** The follow

因此,我创建了这个web应用程序,它将调用服务器以获取有关分支、流、changset信息等的信息。我正在使用p4api.net.dll创建api。我已经下载并解压缩了它,并按照perforce页面上的说明将其连接到服务器

**Problem** 
Using C# and P4API.NET, how to I create a basic program to connect and disconnect from the server?
**Solution**    
The following code can be used as the foundation of a new P4API.NET program.  To use and compile this code, follow these steps:

1. Download the zipped P4API.NET  from the website(www.perforce.com) or the FTP site(ftp://ftp.perforce.com/perforce).  Extract it into a local directory.
2. Open Visual Studio.
3. From the menu, select New->Project...
4. From the Visual C# section, select Console Application
5. Fill in the Name and Location as appropriate.
6. Click the OK Button.
7. Once the new project loads, right-click on the References in the Solution Explorer and select the option  Add Reference... from the context menu.
8. Click on the Browse tab.  Navigate to the folder where you extracted the P4API.NET zipfile, and go into the lib folder.  Select p4api.net.dll (not p4bridge.dll) and click OK.
9. Cut and paste the code from below into the Program.cs file that was automatically created when you created the project, overwriting the default code.
10.Build the code by selecting Build -> Build Solution from the menu.
11.Open Windows Explorer.  Navigate to the folder where you extracted the P4API.NET zipfile, and copy the p4bridge.dll file to the bin/Debug directory of your solution.  You can set up the solution to copy it automatically, but it only needs to be done once.
12.Run the program with Debug -> Start Debugging 

If you want to run the program outside Visual Studio, always make sure that the p4api.net.dll and p4bridge.dll files are included with the binary.  The p4api.net.dll file contains the .NET assembly, while the p4bridge.dll contains the Perforce library.
现在,我跳过了第3-6步,剩下的一直到第11步。在我的webapi项目中,我没有bin/Debug文件夹。我唯一的调试文件夹是在一个obj文件夹中,所以我把它添加到了那里。当我运行api时,我得到以下图像:

到目前为止,我尝试使用以下代码建立连接:

string uri = "server:port";
string user = "username";
string ws_client = "ws_name";

Perforce.P4.Server server = new Perforce.P4.Server(new ServerAddress(uri));
Repository rep = new Repository(server);
Connection con = rep.Connection;

con.UserName = user;
con.Client = new Client();
con.Client.Name = ws_client;

con.Connect(null);

有人能帮我解决这个问题,这样我至少可以启动连接吗?

发现我使用了错误版本的p4api.net.dll。我下载了64位版本,因为我的O/s就是这个版本。我试着下载32位版本,只是想尝试一下,然后重复我的步骤,砰的一声,成功了。我最后把
p4bridge.dll
文件放在安装了p4api.net.dll的bin文件夹中。希望这能帮助任何有我问题的人