简体   繁体   中英

RegistryKey.CreateSubKey not working on Azure hosted environment

I'm using Microsoft.TeamFoundation.Common.dll to do queries on cloud TFS. At some point it tries to create a registry key using RegistryKey.CreateSubKey method, but it fails with:

System.IO.IOException : The specified registry key does not exist .

Works fine on a local machine, but fails when deployed into Azure (as a web site).

I tried givng specific rights to writing to the registry using something like [RegistryPermission(SecurityAction.Assert, ViewAndModify = @"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0")] but with no effect.

Thoughts/suggestions?

Seems like TfsTeamProjectCollection.GetService<WorkItemStore>() does funny things, and not sure why it wants to use the registry (I think it has to do with the integrated functionality in Visual Studio that connects to TFS).

I ended up using the WorkItemStore constructor and passing the TfsTeamProjectCollection instance to it.

Majority of the on-line examples recommend using the tfsTeamProjectCollection.GetService<WorkItemStore> without acknowledging the implications.

Hope this hint can help others in this situation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM