简体   繁体   English

C#中带有MySQL连接器的实体框架

[英]Entity Framework with MySQL connector in c#

I have been trying to get the Entity Framework to work in my web application using MySQL. 我一直在尝试使用MySQL在我的Web应用程序中使用实体框架。 It works fine on my local pc, but doesn't work when I put it on the server. 它可以在我的本地PC上正常工作,但是当我将其放在服务器上时不起作用。

Since the server is a shared server I can install the connector if that is the issue. 由于服务器是共享服务器,因此可以安装连接器。

Your shared web host may restrict you to Medium Trust. 您的共享Web主机可能会将您限制为“中等信任”。 There are known issues with using some db connectors like Devart in a medium trust environment. 在中等信任环境中使用某些数据库连接器(例如Devart)存在已知问题。 In your desktop/dev you are probably running in Full Trust. 在您的桌面/开发环境中,您可能正在“完全信任”状态下运行。

Try setting your site to medium trust in web.config... see if you can duplicate the error. 尝试将您的网站设置为对web.config具有中等信任度...看看是否可以重复该错误。

How To: Is there a way to simulate medium trust in VS2010 如何: 在VS2010中有没有一种方法可以模拟中等信任度

I am currently looking into solutions... but may have to simply change hosts. 我目前正在研究解决方案...但是可能只需要更改主机即可。

您应该能够将MySQL.Data.Dll文件放入BIN文件中。

place mysql.data.dll inside you Bin folder of the application. 将mysql.data.dll放在应用程序的Bin文件夹中。

this should rn on a medium trusted server even. 即使在中等信任的服务器上也应如此。 if you do not know about it and still have the problem please contact your hosting provider and ask him to install mySqlConnector on server. 如果您不知道它仍然有问题,请联系您的主机提供商,并请他在服务器上安装mySqlConnector。

您必须将提供程序库添加到Web应用程序中的bin目录,并在web.config中注册提供程序

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM