unauthorized 项目请求_System.UnauthorizedAccessException访问注册表项

I have some code that calls the TFS API and returns team meta data. (e.g. team names, area paths, etc.) The code works fine locally in Visual Studio ASP.NET MVC project, but fails whenever I deploy to the server.

What I have tried that didn't work:

I granted the AppPool user account Full control to the registry key (did not work)

Also, tried granting Everyone Full Control to the registry key (still did not work)

Any insight into how to set up the correct permissions of configuration for IIS deployed apps to hit the TFS API would be greatly appreciated. (error message below)

Here's the Error message the app produces:

System.UnauthorizedAccessException

Access to the registry key 'HKEY_CURRENT_USER\Software\Microsoft\VSCommon\12.0\ClientServices\TokenStorage\VisualStudio' is denied.

System.UnauthorizedAccessException: Access to the registry key 'HKEY_CURRENT_USER\Software\Microsoft\VSCommon\12.0\ClientServices\TokenStorage\VisualStudio' is denied.

at Microsoft.Win32.RegistryKey.Win32Error(Int32 errorCode, String str)

at Microsoft.Win32.RegistryKey.CreateSubKeyInternal(String subkey, RegistryKeyPermissionCheck permissionCheck, Object registrySecurityObj, RegistryOptions registryOptions)

at Microsoft.Win32.RegistryKey.CreateSubKey(String subkey, RegistryKeyPermissionCheck permissionCheck, RegistryOptions options)

at Microsoft.VisualStudio.Services.Common.TokenStorage.RegistryTokenStorageHelper.GetRootKey(String subkeyName)

at Microsoft.VisualStudio.Services.Common.TokenStorage.RegistryTokenStorage.RetrieveToken(VssTokenKey tokenKey)

at Microsoft.TeamFoundation.Client.TfsClientCredentialStorage.RetrieveToken(Uri serverUrl, VssCredentialsType credentialType)

at Microsoft.TeamFoundation.Client.CookieCredential.OnCreateTokenProvider(Uri serverUrl, HttpWebResponse response)

at Microsoft.TeamFoundation.Client.IssuedTokenCredential.CreateTokenProvider(Uri serverUrl, HttpWebResponse response, IssuedToken failedToken)

at Microsoft.TeamFoundation.Client.TfsClientCredentials.TryGetTokenProvider(Uri serverUrl, IssuedTokenProvider& provider)

at Microsoft.TeamFoundation.Client.Channels.TfsHttpRequestHelpers.PrepareWebRequest(HttpWebRequest webRequest, Guid sessionId, String operationName, CultureInfo cultureInfo, TfsRequestSettings settings, TfsClientCredentials credentials, IdentityDescriptor impersonate, IssuedToken& currentToken, IssuedTokenProvider& tokenProvider)

at Microsoft.TeamFoundation.Client.Channels.TfsHttpRequestHelpers.CreateSoapRequest(Uri requestUri, Guid sessionId, String soapAction, String operationName, CultureInfo cultureInfo, TfsRequestSettings settings, TfsClientCredentials credentials, IdentityDescriptor impersonate, IssuedToken& currentToken, IssuedTokenProvider& tokenProvider)

at Microsoft.TeamFoundation.Client.Channels.TfsHttpWebRequest.CreateWebRequest()

at Microsoft.TeamFoundation.Client.Channels.TfsHttpWebRequest.SendRequest()

at Microsoft.TeamFoundation.Client.Channels.TfsHttpRequestChannel.Request(TfsMessage message, TimeSpan timeout)

at Microsoft.TeamFoundation.Client.Channels.TfsHttpClientBase.Invoke(TfsClientOperation operation, Object[] parameters, TimeSpan timeout, Object[]& outputs)

at Microsoft.TeamFoundation.Framework.Client.RegistrationProxy.GetRegistrationEntries(String toolId)

at Microsoft.TeamFoundation.Framework.Client.RegistrationService.RefreshMemoryCache()

at Microsoft.TeamFoundation.Framework.Client.RegistrationService.Microsoft.TeamFoundation.Server.IRegistration.GetRegistrationEntries(String toolId)

at Microsoft.TeamFoundation.Framework.Client.IdentityManagementService..ctor(TfsConnection tfsBase)

at Microsoft.TeamFoundation.Framework.Client.IdentityManagementService2..ctor(TfsConnection tfsBase)

at Microsoft.TeamFoundation.Client.TfsConnection.CreateInternalProxy(Type serviceType)

at Microsoft.TeamFoundation.Client.TfsConnection.GetServiceInstance(Type serviceType, Object serviceInstance)

at Microsoft.TeamFoundation.Client.TfsConnection.GetService(Type serviceType)

at Microsoft.TeamFoundation.Client.TfsConnection.GetService[T]()

at Microsoft.TeamFoundation.Client.TfsTeamService.QueryTeams(String projectId)

解决方案

I have been having the same problem and have solved it by setting the "Load User Profile" in IIS application pool settings to True.

I don't know if this is some new dependency in TFS 2013 or whether IIS 8.5 has changed the default, but this fixes it for me.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值