首页 新闻 搜索 专区 学院

Vs2008调试运行正常、IIS运行就报错 -- 无法获取执行权限

0
悬赏园豆:5 [已解决问题] 解决于 2010-09-19 13:29
<h2><em>无法获取执行权限。</em> </h2> <p><span style="font-family: Arial, Helvetica, Geneva, SunSans-Regular, sans-serif;"><strong><span style="font-family: Verdana;">说明: </span></strong>执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 <br /><br /><strong><span style="font-family: Verdana;">异常详细信息: </span></strong>System.Security.Policy.PolicyException: 无法获取执行权限。<br /><br /><strong><span style="font-family: Verdana;">源错误:</span></strong> <br /><br /></span></p> <table width="100%" bgcolor="#ffffcc"> <tbody> <tr> <td><code>执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。</code> </td> </tr> </tbody> </table> <p><span style="font-family: Arial, Helvetica, Geneva, SunSans-Regular, sans-serif;"><br /><strong><span style="font-family: Verdana;">堆栈跟踪:</span></strong> <br /><br /></span></p> <table width="100%" bgcolor="#ffffcc"> <tbody> <tr> <td><code> <pre>[PolicyException: 无法获取执行权限。] System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet&amp; denied, Boolean checkExecutionPermission) +7606732 System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet&amp; denied, Int32&amp; securitySpecialFlags, Boolean checkExecutionPermission) +57 [FileLoadException: 未能加载文件或程序集&ldquo;SNV, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null&rdquo;或它的某一个依赖项。未能授予执行权限。 (异常来自 HRESULT:0x80131418)] System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark&amp; stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0 System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark&amp; stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +43 System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark&amp; stackMark, Boolean forIntrospection) +127 System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark&amp; stackMark, Boolean forIntrospection) +142 System.Reflection.Assembly.Load(String assemblyString) +28 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +46 [ConfigurationErrorsException: 未能加载文件或程序集&ldquo;SNV, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null&rdquo;或它的某一个依赖项。未能授予执行权限。 (异常来自 HRESULT:0x80131418)] System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +613 System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +203 System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +105 System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +178 System.Web.Compilation.WebDirectoryBatchCompiler..ctor(VirtualDirectory vdir) +163 System.Web.Compilation.BuildManager.BatchCompileWebDirectoryInternal(VirtualDirectory vdir, Boolean ignoreErrors) +53 System.Web.Compilation.BuildManager.BatchCompileWebDirectory(VirtualDirectory vdir, VirtualPath virtualDir, Boolean ignoreErrors) +175 System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) +86 System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) +261 System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) +101 System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean noAssert) +126 System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp, Boolean noAssert) +62 System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +33 System.Web.UI.PageHandlerFactory.GetHandler(HttpContext context, String requestType, String virtualPath, String path) +37 System.Web.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +307 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +155 </pre> </code></td> </tr> </tbody> </table> <p><span style="font-family: Arial, Helvetica, Geneva, SunSans-Regular, sans-serif;"><br /> <hr size="1" /> <strong><span style="font-family: Verdana;">版本信息:</span></strong>&nbsp;Microsoft .NET Framework 版本:2.0.50727.4927; ASP.NET 版本:2.0.50727.4927 </span></p> <!-- [PolicyException]: 无法获取执行权限。 在 System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Boolean checkExecutionPermission) 在 System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Int32& securitySpecialFlags, Boolean checkExecutionPermission) [FileLoadException]: 未能加载文件或程序集&ldquo;SNV, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null&rdquo;或它的某一个依赖项。未能授予执行权限。 (异常来自 HRESULT:0x80131418) 在 System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) 在 System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) 在 System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) 在 System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) 在 System.Reflection.Assembly.Load(String assemblyString) 在 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) [ConfigurationErrorsException]: 未能加载文件或程序集&ldquo;SNV, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null&rdquo;或它的某一个依赖项。未能授予执行权限。 (异常来自 HRESULT:0x80131418) 在 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) 在 System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() 在 System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) 在 System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) 在 System.Web.Compilation.WebDirectoryBatchCompiler..ctor(VirtualDirectory vdir) 在 System.Web.Compilation.BuildManager.BatchCompileWebDirectoryInternal(VirtualDirectory vdir, Boolean ignoreErrors) 在 System.Web.Compilation.BuildManager.BatchCompileWebDirectory(VirtualDirectory vdir, VirtualPath virtualDir, Boolean ignoreErrors) 在 System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) 在 System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) 在 System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) 在 System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean noAssert) 在 System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp, Boolean noAssert) 在 System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) 在 System.Web.UI.PageHandlerFactory.GetHandler(HttpContext context, String requestType, String virtualPath, String path) 在 System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() 在 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) -->
问题补充: 权限都给了、bin目录下也有SVN、
Weber丶逸轩的主页 Weber丶逸轩 | 菜鸟二级 | 园豆:233
提问于:2010-08-31 17:08
< >
分享
最佳答案
0

SNV 这个程序集无法加载、先确认下 SNV 这个程序集是否在 bin 文件夹内、或者包含在项目文件里面,不能是引用了项目文件外面的程序集。那样在发布后就会没有访问权限的。

收获园豆:3
HUHU慈悲 | 大侠五级 |园豆:9973 | 2010-08-31 17:16
其他回答(2)
0

未能加载文件或程序集

应该找不到文件。

请确定是否引用或者文件是否删除?

无邪兮 | 园豆:207 (菜鸟二级) | 2010-08-31 17:43
0

你的 SNV 是不是还引用了其它程序集,而你又没有放在bin目录下?

收获园豆:2
Launcher | 园豆:45045 (高人七级) | 2010-08-31 18:02
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册