的許可權我試圖將我的MOSS 2007
Web部件遷移到SharePoint 2010
環境。
我的環境是Windows Server 2008 64Bit
,Visual Studio 2008
和SharePoint 2010
。SecurityException未被用戶代碼處理。請求獲得類型爲'System.Security.Permissions.FileIOPermission
在其上添加Web部件現場後面的SharePoint 2010
網站,它正在訪問的log4net
的配置文件,這樣它產生一個錯誤說「拋出:SecurityException是由用戶代碼未處理」。
運行此行的代碼,同時它也越來越:
FileInfo fi = new FileInfo(log4netConfigFilePath);
從異常類型
確切錯誤:
"Request for the permission of type 'System.Security.Permissions.FileIOPermission
, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
failed."
這是堆棧跟蹤:
at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
at System.Security.CodeAccessPermission.Demand()
at System.IO.FileInfo..ctor(String fileName)
at ProjectWorld.Logging.LogManager.Configure()
at ProjectWorld.Logging.LogManager.EnsureConfiguration()
at ProjectWorld.Logging.LogManager.GetLogger(WebPart webPart)
at ProjectWorld.WebParts.PRSWebParts.QBWebPart..ctor()
at T_c39ca68b_5b0a_4d36_b052_e470116a6771.CreateInstance()
at System.Web.HttpRuntime.FastCreatePublicInstance(Type type)
at System.Web.UI.WebControls.WebParts.WebPartManager.ImportWebPart(XmlReader reader, String& errorMessage)
我試圖運行此代碼在Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges
下,但它也產生了這個錯誤。
請幫我解決這個錯誤。
喜應用程序了在完全信任水平已經運行 – 2009-12-24 07:03:09