Sunday, July 5, 2009

'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral

The error 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed generally occurs when try to run the stored procedure.

This error often occurs when try to run the Stored Procedure from the web application.

Possible Reason

1. Not enough security permission for the stored Procedure

2. Anything that access database from SP requires at least the
WSS_Medium security policy in the web.config file.

3. If the security message is from the web part, it's usually the trust element in the web.config file.


How to Fix?

1. Open wss_mediumtrust.config & wss_minimaltrust.config files

2. The normal path is (C:\Program Files\Common Files\Microsoft Shared\Web Server
Extensions\12\config\)

3. We can find the exact path in web.config file


4. Find in the wss_mediumtrust.config File:





5. Copy and paste it in to the node of
wss_minimaltrust.config file.


6. In the PermissionSet section of this configuration file, add the
following:

Find in wss_mediumtrust.config:

Copy and paste it in to the a node of
wss_minimaltrust.config.


7. Goto Control Panel - Administrative Tools

8. Goto .NET Framework configuration settings

9.a) Expand the runtime security policy.

b) expand machine

c) expand code groups

d) right click all_code

e) Click on properties

f) Click on permission tab

g) Set Modified nothing to Full Trust

No comments:

Post a Comment