首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET Framework >

.net 权限有关问题

2012-09-05 
.net 权限问题第一个问题:HTML code安全性异常 说明: 应用程序试图执行安全策略不允许的操作。要授予此应用

.net 权限问题
第一个问题:

HTML code
安全性异常 说明: 应用程序试图执行安全策略不允许的操作。要授予此应用程序所需的权限,请与系统管理员联系,或在配置文件中更改该应用程序的信任级别。 异常详细信息: System.Security.SecurityException: 请求“System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089”类型的权限已失败。源错误: 行 30:     {行 31:         string sql = "select UserName from Tab_GuestBook";行 32:         DataTable dt = CSA.DAL.DBAccess.getRS(sql);行 33:         foreach (DataRow dr in dt.Rows)行 34:         { 源文件: \\bingnian\测试共享\Default.aspx.cs    行: 32 堆栈跟踪: [SecurityException: 请求“System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089”类型的权限已失败。]   System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0   System.Security.PermissionSet.Demand() +83   System.Data.Common.DbConnectionOptions.DemandPermission() +40   System.Data.SqlClient.SqlConnection.PermissionDemand() +44   System.Data.SqlClient.SqlConnectionFactory.PermissionDemand(DbConnection outerConnection) +20   System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +117   System.Data.SqlClient.SqlConnection.Open() +122   CSA.DAL.SqlHelper.PrepareCommand(SqlCommand cmd, SqlConnection conn, SqlTransaction trans, CommandType cmdType, String cmdText, SqlParameter[] cmdParms) +92   CSA.DAL.SqlHelper.getRs(String connectionString, String cmdText, CommandType cmdType, SqlParameter[] paras, String tblName, Int32 pageIndex, Int32 pageSize, String sortExpression, Int32& RecordCount) +211   CSA.DAL.SqlHelper.getRs(String cmdText) +79   CSA.DAL.DBAccess.getRS(String cmdText) +75   _Default.GetDataByCSA() in \\bingnian\测试共享\Default.aspx.cs:32   _Default.Page_Load(Object sender, EventArgs e) in \\bingnian\测试共享\Default.aspx.cs:14   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35   System.Web.UI.Control.OnLoad(EventArgs e) +99   System.Web.UI.Control.LoadRecursive() +50   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6785   System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +242   System.Web.UI.Page.ProcessRequest() +80   System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21   System.Web.UI.Page.ProcessRequest(HttpContext context) +49   ASP.default_aspx.ProcessRequest(HttpContext context) in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\测试共享\700ce6e8\de7cab67\App_Web_30r7luoa.0.cs:0   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75 


第二个问题:
C# code
“/测试共享”应用程序中的服务器错误。--------------------------------------------无法获取所需的权限。 说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Security.Policy.PolicyException: 无法获取所需的权限。源错误: 执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。  堆栈跟踪: [PolicyException: 无法获取所需的权限。]   System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Boolean checkExecutionPermission) +7606595   System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Int32& securitySpecialFlags, Boolean checkExecutionPermission) +57[FileLoadException: 未能加载文件或程序集“System.Data.SQLite, Version=1.0.65.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139”或它的某一个依赖项。未能授予最小权限请求。 (异常来自 HRESULT:0x80131417)]   System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0   System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +43   System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +127   System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +142   System.Reflection.Assembly.Load(String assemblyString) +28   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +46[ConfigurationErrorsException: 未能加载文件或程序集“System.Data.SQLite, Version=1.0.65.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139”或它的某一个依赖项。未能授予最小权限请求。 (异常来自 HRESULT:0x80131417)]   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.BuildProvidersCompiler..ctor(VirtualPath configPath, Boolean supportLocalization, String outputAssemblyName) +54   System.Web.Compilation.CodeDirectoryCompiler.GetCodeDirectoryAssembly(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories, Boolean isDirectoryAllowed) +8826642   System.Web.Compilation.BuildManager.CompileCodeDirectory(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories) +128   System.Web.Compilation.BuildManager.CompileCodeDirectories() +265   System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +320[HttpException (0x80004005): 未能加载文件或程序集“System.Data.SQLite, Version=1.0.65.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139”或它的某一个依赖项。未能授予最小权限请求。 (异常来自 HRESULT:0x80131417)]   System.Web.Compilation.BuildManager.ReportTopLevelCompilationException() +58   System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +512   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters) +729[HttpException (0x80004005): 未能加载文件或程序集“System.Data.SQLite, Version=1.0.65.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139”或它的某一个依赖项。未能授予最小权限请求。 (异常来自 HRESULT:0x80131417)]   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +8907951   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +85   System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +259  



这两个问题困扰了两个星期,到现在还是没有解决,请问有高手能告诉我怎么解决吗?解决分数全给了

[解决办法]
没有的,我试过了

热点排行