问题
how do i access Mysql from an ASP.NET 2 site in medium trust mode? My ISP wont allow my site to run under full trust and i've tried many(if not all) mysql apis to connect to the db.
All result in either SocketPermission or FileIOPermission errors. i have even tried overriding the trust setting in my web.config.
Any ideas?
回答1:
Ask them to put the MySQL assemblies in the GAC. This is a common issue with third-party databases and Medium Trust.
I'll add that you're going to have to sweet talk them. They're going to need to trust the software they're going to be installing to not destroy their servers. So you'll need to explain that it's established software and give them the URL to the site.
The other option is to get them to alter the state of the trust zone slightly. This looks a little more suspicious but it doesn't involve touching the GAC.
来源:https://stackoverflow.com/questions/217989/net-2-0-and-mysql-in-medium-trust-mode