Cannot perform CAS Asserts in Security Transparent methods security level issue

此生再无相见时 提交于 2020-01-02 06:42:25

问题


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)

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


回答1:


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.

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?



来源:https://stackoverflow.com/questions/17095120/cannot-perform-cas-asserts-in-security-transparent-methods-security-level-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!