我怎么能答应我的ASP.NET MVC应用程序读取访问注册表项?

问题描述:

我读到了如何做到这一点,但无济于事其他职位。当我部署我的应用程序服务器(2008年)我得到以下异常运行时:

I have read other posts about how to accomplish this but to no avail. When I deploy my application to the server (2008) I get the following exception at runtime:

Access to the registry key 'HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\TeamFoundation\Servers' is denied.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.UnauthorizedAccessException: Access to the registry key 'HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\TeamFoundation\Servers' is denied. 

ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user. 

要授予ASP.NET对文件的访问,用鼠标右键单击资源管理器中的文件,选择属性,然后选择安全选项卡。点击添加添加适当的用户或组。突出显示ASP.NET帐户,并检查盒为所需的访问。

To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.

因此​​,错误似乎很描述。我打开注册表编辑器,右点击了KEY(HKEY_CURRENT_USER \ SOFTWARE \微软) - >权限 - >添加用户网络SERIVCE,并授予完全控制

So the error seems very descriptive. I opened regedit and right clicked on the KEY (HKEY_CURRENT_USER\Software\Microsoft) --> Permissions --> Added user 'NETWORK SERIVCE' and granted FULL Control.

我以为这是ASP.NET跑了访问注册表的用户。

I assumed this was the user that ASP.NET was running over to access the registry.

然后我试图禁用包括可从该对象的父项继承的权限。

I then tried to disable 'Include inheritable permissions from this object's parent.

这也没有工作。

从IIS管理器中,在我的应用程序的身份验证设置,我设置了匿名身份验证用户自己这是在管理员组中

From within IIS Manager, under my application's authentication settings I set the 'anonymous authentication' user to my own which is in in the Administrator's group.

似乎没有任何工作。

我怎样才能解决这个问题?这是我们当地的网络上运行一个内部工具,所以我不是很关心在这个阶段的安全权限。我怎样才能授予相应的权限?

How can I resolve this issue? This is an internal tool running on our local network so I am not very concerned with security permissions at this stage. How can I grant the appropriate privileges?

谢谢!

这是很难不知道你的Web应用程序上,努力实现解决。不过,我想这是一个网络基本应用程序,这意味着你已经创建了一个数据库为您的网页。首先,在您的Web.config'connectionString,请尝试使用您用于登录到SQL Server管理用户名和密码。不要使用Windows登录。其次,尝试运行使用F5功能键应用程序。这将启动与Visual Studio 2008。在此之前并不需要本地IIS内置的服务器。

It is hard to troubleshoot without knowing what your web application is trying to accomplish. However, I assume this is a web-base application which means you have created a db for your web. First, In your Web.config'connectionString', try using the username and password you used to login to SQL Server Management. Do not use a windows login. Second, trying running your application using F5 function key. This will start a built-in server that came with Visual Studio 2008. This does not require local IIS.

如果仍然有问题,可以邮寄或给我你的web.config。看看我可以提供帮助。

If still having problem, either post or send me your Web.config. See if I can help.