4
I’m using the Entity Framework
for Mysql
.
I installed the .Net Connector
, and the MySQL.Data.Entities
.
Locally it is working normally. But when I go up to the LocaWeb
, will not.
The following error appears:
Cannot perform CAS Asserts in Security Transparent methods
Description: An unhandled Exception occurred During the Execution of the Current web request. Please review the stack trace for more information about the error and Where it originated in the code.
Exception Details: System.Invalidoperationexception: Cannot perform CAS Asserts in Security Transparent methods
Source Error:
An unhandled Exception was generated During the Execution of the Current web request. Information regarding the origin and Location of the Exception can be identified using the Exception stack trace Below.
Stack Trace:
[Invalidoperationexception: Cannot perform CAS Asserts in Security Transparent methods]
Mysql.Data.Mysqlclient.MySqlClientFactory.. ctor() +24
Mysql.Data.Entity.MySqlEFConfiguration.. ctor() +73[Targetinvocationexception: Exception has been thrown by the target of an Invocation. ] System.RuntimeTypeHandle.Createinstance(Runtimetype type type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached,
My Web.config:
<connectionStrings>
<add name="BancoDados" providerName="MySql.Data.MySqlClient" connectionString="Data Source=xxxx; port=3306; Initial Catalog=bancoMySQL; uid=usuarioMySQL; pwd=qwe123qwe;" />
</connectionStrings>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.8.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"></provider>
</providers>
</entityFramework>
I started doing some research and came up with a reference from LocaWeb
:
Locaweb on the topic:
Mysqlconnector / Unable to find the requested . Net Framework Data Provider. It may not be installed
So by doing what you say on the topic, I added
And
<system.data>
<DbProviderFactories>
<clear />
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.8.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data>
But it had no effect.
I even found a page on the Internet, but I didn’t quite understand the procedure I was talking about, and I think it’s the same one that recommends Locaweb, but I’ll leave the LINK
Locaweb? I will pray for your soul.
– Leonel Sanches da Silva
You did
Copy Local = True
on Dlls prior to publication?– Leonel Sanches da Silva
@Ciganomorrisonmendez, in ALL Dlls or only which refer to Mysql?
– Diego Zanardo
The ideal was all because Locaweb is boring for everything.
– Leonel Sanches da Silva
@Gypsy omorrisonmendez, still same mistake!!!
– Diego Zanardo
I don’t know much about Locaweb, but there is the possibility of registering Assemblies in the machine’s GAC?
– Leonel Sanches da Silva
@Ciganomorrisonmendez, no... As far as I know no, the only thing I can do is upload files... hahaha!
– Diego Zanardo
Well, here’s the thing: that mistake means that Assembly cannot be fully enforced by safety restrictions. I think that in this case it is best to contact Locaweb support to ask for guidance directly for them. You can’t answer that because it can be many things, and you don’t have a single solution.
– Leonel Sanches da Silva
Really personal, at Locaweb only works with the Mysqlconnector version below the 6.3.
– user25783