Notifications
Clear all

[Closed] .net Socket Permission?

I’m using the MySQL ADO.net DLL to connect to SQL. It used to work perfectly. But now, maybe because of Windows 7, maybe because of Max, Maybe because of shifting solar flares it gives me this error:

Runtime error: dotNet runtime exception: Request for the permission of type ‘System.Net.SocketPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’ failed.

Anyone seen this? Know how to work around. I saw something about changing .net config files, which sounded confusing and difficult–especially if I wanted to deploy. Anyone still using MySQL and run into this or using something else and run into this or have a way to get it to work without a security error?

By the way here’s my code:

	struct SQL (
			function Connect host:"192.168.94.11" database:"SXXX" user:"XXXXX" password:"XXXXX" driver:"O:\\Program Files\\MySQLDriver\\MySql.Data.dll"=
			(
				dotNet.loadAssembly driver
				connectionString = ("Database=" + database + ";Data Source=" + host + ";User Id=" + user + ";Password=" + password)
				DBConnection = dotNetObject "MySql.Data.MySqlClient.MySqlConnection"
				DBConnection.ConnectionString = connectionString
				DBConnection.open()	
				return DBConnection
			)
)

1 Reply

Found the solution.

Files Copied off of a network or downloaded from the internet are considered “blocked” DLLs by Windows. you have to right click on the DLL, go to properties and push the “unblock” button.

http://blogs.msdn.com/b/drew/archive/2009/12/24/xunit-and-td-net-fixing-the-attempt-was-made-to-load-an-assembly-from-a-network-location-problem.aspx