我该如何解决这个错误? [英] How can I solve this error?

查看:68
本文介绍了我该如何解决这个错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在Web服务器上运行(加载)包含水晶报表查看器的.aspx页面时,它会出现此错误。我怎么解决呢?请帮助...



我尝试过的事情:



服务器'/'应用程序出错。



安全例外



描述:应用程序试图执行操作安全策略不允许。要授予此应用程序所需的权限,请与您的系统管理员联系或在配置文件中更改应用程序的信任级别。



异常详细信息:System.Security.SecurityException:请求类型'System.Security.Permissions.FileIOPermission,mscorlib,Version = 4.0.0.0,Culture =的权限中性,PublicKeyToken = b77a5c561934e089'失败。



来源错误:





第17行:{

第18行:ReportDocument crystalReport = new ReportDocument();

第19行:crystalReport.Load(Server.MapPath(〜/ CrystalReport1.rpt) ));

第20行:DataSet1 dsCustomers = GetData(select * from tblorderdetails);

第21行:crystalReport.SetDataSource(dsCustomers);

when i run(load) ".aspx" page that contain crystal report viewer on web server it gives this error. how can i solve it? Please Help...

What I have tried:

Server Error in '/' Application.

Security Exception

Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Source Error:


Line 17: {
Line 18: ReportDocument crystalReport = new ReportDocument();
Line 19: crystalReport.Load(Server.MapPath("~/CrystalReport1.rpt"));
Line 20: DataSet1 dsCustomers = GetData("select * from tblorderdetails");
Line 21: crystalReport.SetDataSource(dsCustomers);

推荐答案

阅读错误消息:

Read the error message:
Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.



完全按照其说法执行:您的网页应用程序是尝试执行需要具有特定权限的IO操作。只有您的管理员可以更改您的应用运行的权限,或者它尝试访问的文件夹或文件的权限。


The do exactly what it says: your web page app is trying to perform an IO operation that needs it to have specific permissions. Only your admin can change the permissions your app runs under, or the permissions on the folder or file it is trying to access.


如OriginalGriff所述,它是一个访问权限问题,请在下面添加web.config中的标记

As stated by OriginalGriff, its a access permission issue, add below tag in web.config
<system.web>
<trust level="Full"/>
</system.web>



希望有帮助


Hope it helps


这篇关于我该如何解决这个错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆