break

Bug: SqlClient.SqlClientPermission

I was building a Windows Presentation Foundation browser application, and somewhere in my code I was trying to open a SqlConnection, and the error appeared.

“Request for the permission of type ‘System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089′ failed.”

I had this annoying bug, which at the end it wasn’t that bad to solve.

The solution:

If you do a right click in the properties of your solution, and you go to security, click on “This is a full trust application”. This should solve this problem.

I would also like to thank Animesh for his input in this topic. He had another solution to it, and according to him “There was a change needed in web.config. Increased the trust level to full for security policies and it worked”.

If you have another way to solve this problem, please comment it, and let me know.

3 Responses

  1. Animesh Says:

    I am having the same problem with web application. I try to connect to SQL Server 2005 and it fails with exact same exception. In Solution Properties There is no security tab….

    Any Ideaz???

  2. Lothar Says:

    not the Solution properties, you have to go on the Properties of your WPF Browser Project! and change the Security to full trust!!!

    lothar

  3. Alex Says:

    Thank you lothar that solve the problem :-)

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.

CAPTCHA Image
Reload Image