Home All Groups Group Topic Archive Search About

Problems with code access security policy

Author
22 Sep 2006 2:54 PM
Grober Myttelson
I have made a small app that resides on a server share. It needs to draw
some data from a SQL Server database that resides on yet another server. And
the app should be possible to run from client computers.

When we run it from clients we get the following error: "Request for the
permission of type System.Data.SqlClient.SqlClientPermission, System.Data,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
failed".

I have tried to change the code access security policy on the SQL Server
server by using Microsoft .NET Framework 1.1 Configuration - Increase
Assembly Trust and added the path \\AppServerName\c$\AppFolder\App.exe but I
still get the error when running the app from a client.

What more can I do?

Regards
/Grober

Author
23 Sep 2006 1:04 PM
Nicole Calinoiu
Changing the CAS policy on the server won't help.  Your application is being
prevented from connecting to the database because of CAS policy on the
client machines, not on the server.  To address this, you will need to
modify the CAS policy on the client machines to grant the necessary
SqlClientPermission to your assembly.  See
http://blogs.msdn.com/shawnfa/archive/2003/06/20/57023.aspx for details.


Show quoteHide quote
"Grober Myttelson" <grottekvar***@hotmail.com> wrote in message
news:%23O3kJcl3GHA.600@TK2MSFTNGP05.phx.gbl...
>I have made a small app that resides on a server share. It needs to draw
>some data from a SQL Server database that resides on yet another server.
>And the app should be possible to run from client computers.
>
> When we run it from clients we get the following error: "Request for the
> permission of type System.Data.SqlClient.SqlClientPermission, System.Data,
> Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
> failed".
>
> I have tried to change the code access security policy on the SQL Server
> server by using Microsoft .NET Framework 1.1 Configuration - Increase
> Assembly Trust and added the path \\AppServerName\c$\AppFolder\App.exe but
> I still get the error when running the app from a client.
>
> What more can I do?
>
> Regards
> /Grober
>
Author
27 Sep 2006 2:48 PM
Grober Myttelson
It's working, thank you, splendid article that explains things in a mode
that is sufficient for me.

Regards
/Grober

Show quoteHide quote
"Nicole Calinoiu" <calinoiu REMOVETHIS AT gmail DOT com> skrev i meddelandet
news:EFD4C182-B9B4-40F1-891F-F16BBD122E39@microsoft.com...
> Changing the CAS policy on the server won't help.  Your application is
> being prevented from connecting to the database because of CAS policy on
> the client machines, not on the server.  To address this, you will need to
> modify the CAS policy on the client machines to grant the necessary
> SqlClientPermission to your assembly.  See
> http://blogs.msdn.com/shawnfa/archive/2003/06/20/57023.aspx for details.
>
>
> "Grober Myttelson" <grottekvar***@hotmail.com> wrote in message
> news:%23O3kJcl3GHA.600@TK2MSFTNGP05.phx.gbl...
>>I have made a small app that resides on a server share. It needs to draw
>>some data from a SQL Server database that resides on yet another server.
>>And the app should be possible to run from client computers.
>>
>> When we run it from clients we get the following error: "Request for the
>> permission of type System.Data.SqlClient.SqlClientPermission,
>> System.Data, Version=1.0.5000.0, Culture=neutral,
>> PublicKeyToken=b77a5c561934e089 failed".
>>
>> I have tried to change the code access security policy on the SQL Server
>> server by using Microsoft .NET Framework 1.1 Configuration - Increase
>> Assembly Trust and added the path \\AppServerName\c$\AppFolder\App.exe
>> but I still get the error when running the app from a client.
>>
>> What more can I do?
>>
>> Regards
>> /Grober
>>
>