2009-12-31 60 views
3

當我把DotNetOpenAuth DLL加載到我的/ bin目錄的時候,我的應用程序將不會與以下堆棧跟蹤運行。有沒有人有這個圖書館的經驗?我瀏覽了他們的文檔,懷疑我沒有正確部署它。我的網絡應用程序應該完全信任我的本地計算機,因此尚不清楚它要求的那些無法獲得的權限。PolicyException使用DotNetOpenAuth庫

謝謝! 湯姆

[PolicyException: Required permissions cannot be acquired.] 
    System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Boolean checkExecutionPermission) +10238142 
    System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Int32& securitySpecialFlags, Boolean checkExecutionPermission) +97 

[FileLoadException: Could not load file or assembly 'DotNetOpenAuth, Version=3.3.1.9337, Culture=neutral, PublicKeyToken=2780ccd10d57b246' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)] 
    System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0 
    System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +416 
    System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +166 
    System.Reflection.Assembly.Load(String assemblyString) +35 
    System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +190 

[ConfigurationErrorsException: Could not load file or assembly 'DotNetOpenAuth, Version=3.3.1.9337, Culture=neutral, PublicKeyToken=2780ccd10d57b246' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)] 
    System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +11207304 
    System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +388 
    System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +232 
    System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() +48 
    System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +210 
    System.Web.Compilation.BuildProvidersCompiler..ctor(VirtualPath configPath, Boolean supportLocalization, String outputAssemblyName) +76 
    System.Web.Compilation.CodeDirectoryCompiler.GetCodeDirectoryAssembly(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories, Boolean isDirectoryAllowed) +11196482 
    System.Web.Compilation.BuildManager.CompileCodeDirectory(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories) +185 
    System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +551 

[HttpException (0x80004005): Could not load file or assembly 'DotNetOpenAuth, Version=3.3.1.9337, Culture=neutral, PublicKeyToken=2780ccd10d57b246' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)] 
    System.Web.Compilation.BuildManager.ReportTopLevelCompilationException() +76 
    System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +1012 
    System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters) +1025 

[HttpException (0x80004005): Could not load file or assembly 'DotNetOpenAuth, Version=3.3.1.9337, Culture=neutral, PublicKeyToken=2780ccd10d57b246' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)] 
    System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11301302 
    System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +88 
    System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4338644 

回答

4

奇怪的是,我找到了解決辦法是有關this

應用程序池標識有一個名爲「加載用戶配置文件」的 屬性。 當此值爲假,則可能 收到上述錯誤。爲了 解決這個問題,打開IIS管理器,然後導航 您的應用程序池 身份。您可以在 高級設置窗口中找到該設置。將 更改爲true。

我發現當我將它設置爲true時,庫再次開始工作。當我將其重新設置爲false時,即使重新啓動服務並重新啓動應用程序池,它仍然可以繼續工作。所以,奇怪的是現在一切都好了。

+0

OMG OMG OMG OMG OMG是的,我這裏發生了FULL CAPS,謝謝TLIANZA !!!!!!在使用iis7移植到新服務器之後,我已經把這個頭髮拉出了幾個星期了!謝謝 – MvcCmsJon

1

它看起來像代碼訪問安全性不考慮DotNetOpenAuth以完全信任來加載。它只需要媒體的信任,實際上,這裏卻是最低權限DotNetOpenAuth請求列表:

[assembly: SecurityPermission(SecurityAction.RequestMinimum, Execution = true)] 
[assembly: WebPermission(SecurityAction.RequestMinimum, ConnectPattern = @"http://.*")] 
[assembly: WebPermission(SecurityAction.RequestMinimum, ConnectPattern = @"https://.*")] 

第二夫婦可以從一些中等信任配置丟失,但同樣,如果你與它應該完全信任運行是一個非問題。

嘗試將<trust level="Full"/>添加到您的web.config文件的<system.web>部分,看看是否有幫助,或生成一個錯誤,這將有助於縮小問題範圍。

相關問題