Microsoft.Web.Administration:System.UnauthorizedAccessException [英] Microsoft.Web.Administration: System.UnauthorizedAccessException
本文介绍了Microsoft.Web.Administration:System.UnauthorizedAccessException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在C#程序中使用Windows.Web.Administration
dll来管理IIS 7(我仅使用方法Recycle
).
I use the Windows.Web.Administration
dll in a C# program to manage IIS 7 (I use only the method Recycle
).
第一个问题是:
System.UnauthorizedAccessException: Filename: redirection.config
Error: Cannot read configuration file due to insufficient permissions
然后我在文件夹C:\Windows\System32\inetsrv
处添加了完全控制的NETWORK SERVICE
.
And later I have added NETWORK SERVICE
with full control at the folder C:\Windows\System32\inetsrv
".
现在我出现此消息错误:
Now I have this message error:
System.UnauthorizedAccessException: Access is denied. (Exception from
HRESULT: 0x80070005 (E_ACCESSDENIED))
at Microsoft.Web.Administration.Interop.IAppHostProperty.get_Value()
at Microsoft.Web.Administration.ConfigurationElement.GetPropertyValue(IAppHostProperty property)
at Microsoft.Web.Administration.ConfigurationElement.GetAttributeValue(String attributeName)
at Microsoft.Web.Administration.ApplicationPool.get_State()
如何避免这种情况?
推荐答案
以管理员身份运行程序,或者如果您在VS中,则以管理员身份运行VS.
Run your program as administrator, or if you are in VS run VS as administrator.
MWA需要管理员权限才能与IIS接口通信.
MWA requires administrator permissions to talk to IIS interfaces.
这篇关于Microsoft.Web.Administration:System.UnauthorizedAccessException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文