System.UnauthorizedAccessException访问注册表项 [英] System.UnauthorizedAccessException Access to the registry key

查看:1611
本文介绍了System.UnauthorizedAccessException访问注册表项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些代码调用TFS API并返回团队元数据。 (例如团队名称,区域路径等)代码在Visual Studio ASP.NET MVC项目中本地工作正常,但每当我部署到服务器时都会失败。

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.

我尝试过的不起作用:

我授予了AppPool用户帐户完全控制注册表项(无法正常工作
此外,尝试向注册表项授予Everyone完全控制权(仍然无法正常工作
非常感谢有关如何为IIS部署的应用程序设置正确的配置权限以获得TFS API的任何见解。 (错误消息

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)

以下是应用产生的错误消息:

System.UnauthorizedAccessException

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)


推荐答案

我去过有同样的问题并通过将IIS应用程序池设置中的加载用户配置文件设置为 True 来解决它。

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

我不知道知道这是否是TFS 2013中的一些新依赖项,或者IIS 8.5是否已更改默认值,但这会为我修复它。

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.

这篇关于System.UnauthorizedAccessException访问注册表项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆