无法在“安全透明方法"安全级别问题中执行CAS声明 [英] Cannot perform CAS Asserts in Security Transparent methods security level issue
问题描述
我在主机上遇到此错误.
I encountered this error on host.
System.InvalidOperationException: Cannot perform CAS Asserts in Security Transparent methods
at System.Security.CodeAccessSecurityEngine.CheckNReturnSO(PermissionToken permToken, CodeAccessPermission demand, StackCrawlMark& stackMark, Int32 create)
at System.Security.SecurityRuntime.Assert(PermissionSet permSet, StackCrawlMark& stackMark)
at System.Security.PermissionSet.Assert()
at MySql.Data.MySqlClient.MySqlParameter.SetTypeFromValue()
at MySql.Data.MySqlClient.MySqlParameter.set_Value(Object value)
at MySql.Data.MySqlClient.MySqlParameter..ctor(String parameterName, Object value)
但是在localhost项目中成功运行.我使用的是asp.net 4.0和mysql.在某些资源中,我必须更改信任级别,但不能更改.因为我的托管公司不允许为此更改Web配置文件主题.如何在不更改Web配置的情况下更改信任级别.如何解决此问题? 预先感谢
But in localhost project succesfully run.I'm using asp.net 4.0 and mysql.In some resources say I have to change trust level but I cannot change.Because my hosting firm doesn't allow web config file change for this subject.How can I change trust level without web config change.How can I solve this problem? Thanks in advance
推荐答案
我猜您正在使用共享主机,因此,如果他们没有授予您权限,则无法更改信任级别.
I guess you are using a shared host, so there's no way you can changed trust level if they don't give you permissions to do it.
您正在使用哪个版本的MySQL连接器? 您是否尝试过将它们复制到项目的\ bin文件夹中? (右键单击MySQL.*参考并设置为"Copy Local = true")
What versions of the MySQL connector are you using? Have you tried copying them to the \bin folder of your project? (right-click on MySQL.* references and setting then to "Copy Local = true")
您是否可以尝试从本地主机连接到数据库服务器,以确保您的连接字符串参数正常?
Are you able to try to connect to your database server from localhost to make sure your connection string parameters are ok?
这篇关于无法在“安全透明方法"安全级别问题中执行CAS声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!