Reputation: 119
When I try to access a SQL command by a web service developed in C# .Net I have this error.
The Web serice is called by a windows form application in C# too.
This is the error:
"Falha na solicitação da permissão de tipo 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral,"
This is my code:
Sql query = new Sql();
StringBuilder comando = new StringBuilder();
comando.Append("SELECT EntCod FROM ENT001 T1 (NOLOCK) " +
"WHERE T1.EntCpfCgc = @ENTCPFCGC ");
query.addParametro("ENTCPFCGC", CPFCGC);
DataTable resultado = query.Select(comando.ToString()).Tables[0];
The "SQL" class is a control class that connect on SQL server DB.
Upvotes: 1
Views: 698
Reputation: 119
I´ve solved my problem with this DOS commands:
C:\windows\microsoft.net\framework\v2.0.50727\caspol.exe -machine -chggroup 1 FullTrust
C:\windows\microsoft.net\framework\v2.0.50727\caspol.exe -user -chggroup 1 FullTrust
C:\windows\microsoft.net\framework\v2.0.50727\caspol.exe -enterprise -chggroup 1 FullTrust
Giving "FullTrust" permissions on this file.
Thanks all for reply!
Upvotes: 1