How to set the path to store client-side cache information

Examples of programs integrating with Vault and Fortress API. Also, information on integrating with NAnt, CruiseControl.Net and other third-party tools

Moderator: SourceGear


Posts: 1821
Joined: Thu Dec 18, 2003 11:39 am
Location: Sourcegear
PostPosted: Wed Oct 14, 2009 3:20 pm
Occasionally, users need to run an API program as a Windows service. The problem with this is that the Vault Client needs to store its client cache files on disk. The default location is the Window's user's application data directory. When running as a service, the Windows account might not have an application data directory. If you need to specify the cache location, you may use this code instead of the normal login API code. Please note that the Windows account running the API code must have full control of the cache directory.

Code: Select all
ServerOperations.client.ClientInstance = new ClientInstance();
ServerOperations.client.ClientInstance.Init(VaultClientNetLib.VaultConnection.AccessLevelType.Client, "c:\\path\\to\\cache\\directory");
//This next line seems redundant, but it's important to work around a
//serveroperations bug.
ServerOperations.client.LoginOptions.User = "username";
ServerOperations.client.ClientInstance.Login("http://localhost/VaultService", "username", "password");
ServerOperations.SetRepository("Initial repository");
Subscribe to the Fortress/Vault blog

Return to Examples (API)

Who is online

Users browsing this forum: No registered users and 2 guests