Page 1 of 1

Vault_CacheMember_Repository_689544213 is denied.

Posted: Thu Aug 05, 2010 8:20 pm
by steventech
I have a COM (MyCOM) that is written with C# and call the Vault API.
And there are two applications that will call the COM,
1 One is windows client application , written with C++ , and will call the COM with the way (#import "MyCOM.tlb" # using namespace MyCOM; )
2 Another is IIS application, written with C++ , call the COM with the same way, and run under IIS

When on one machine two Windows client applications run at the same time and call Vault API function SetActiveRepositoryID , they works well.
When on one machine two users open the IIS's page which will also call the Vault API function SetActiveRepositoryID from IE, they works well.

But When the IIS application starts first , and then run window client application , the windows client application will not work and throw following exception.
When the windows client application start first ,then run IIS application, the IIS application can't work and throw following exception too.
Following is the exception information :
System.UnauthorizedAccessException: Access to the path 'Vault_CacheMember_Repository_689544213' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.Threading.Mutex.<>c__DisplayClass3.<.ctor>b__0(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.Mutex..ctor(Boolean initiallyOwned, String name, Boolean& createdNew, MutexSecurity mutexSecurity)
at System.Threading.Mutex..ctor(Boolean initiallyOwned, String name)
at VaultLib.SystemMutex..ctor(String name)
at VaultClientOperationsLib.CacheMember..ctor(String folder)
at VaultClientOperationsLib.CacheMember_Repository..ctor(String folder)
at VaultClientOperationsLib.TreeCache.Load()
at VaultClientOperationsLib.TreeCache..ctor(Int32 repID, String username, String uniqueRepositoryID, String localStoreBasePath, ClientInstance ci)
at VaultClientOperationsLib.ClientInstance.SetActiveRepositoryID(Int32 id, String username, String uniqueRepositoryID, Boolean doRefresh, Boolean updateKnownChangesAll)


There are related issues links
http://support.sourcegear.com/viewtopic ... 95&start=0
http://support.sourcegear.com/viewtopic ... 30&t=10951
How can I do with that ?
Thank you very much.

Re: Vault_CacheMember_Repository_689544213 is denied.

Posted: Fri Aug 06, 2010 7:27 am
by jclausius
Try creating / placing a system wide, NAMED mutex around both apps call to SetActiveRepositoryID(). By synchronizing access to this method of both apps, you might be able to avoid the problem.

Re: Vault_CacheMember_Repository_689544213 is denied.

Posted: Wed Aug 11, 2010 4:53 pm
by steventech
If I restart the IIS , the client will work.
And if I close the client, then restart the IIS ,the IIS's App will work.
I need the client and web to work at one time , and I don't want to make it Complex.
Thank you very much

Re: Vault_CacheMember_Repository_689544213 is denied.

Posted: Wed Aug 11, 2010 4:53 pm
by steventech
Thank you very much for your replay.
I added the Mutex to my Apps, and it met the same problem.
If Two client's Apps call the COM at one time, they will work well.
But If one Client and IIS's Apps call the COM at one time ,the one which first call the COM will work well , anther will not work.
I don't know if it is the problem that the IIS's App call the COM, and the COM will create a thread or process which will access the cache file "Vault_CacheMember_Repository_689544213" , and the Client App call the COM, the COM's new thread or process can't access the cache file because of the thread no privilege or because of the IIS's setting

Re: Vault_CacheMember_Repository_689544213 is denied.

Posted: Mon Aug 16, 2010 7:44 am
by jclausius
Did you create / enter the named mutexes in your own code BEFORE the call to SetRepositoryID()? If so, have you debugged both so when process_1 enters "my-named-mutex", process_2 blocks on "my-named-mutex", and when process_1 exits the mutex, process_2 enters?