我在將我的網站(asp.net mvc3)連接到MySQL時遇到問題。將ASP.NET MVC3網站連接到MySQL的問題
本地主機正在工作,但在服務器上我收到以下錯誤:
Error: Unable to locate the Data Provider. Requested Net Framework. Maybe it is not installed.
Stacktrace: [ArgumentException: The repository provider specified is not found in the configuration or is not valid.]
System.Data.EntityClient.EntityConnection.GetFactory(String providerString) +11468668
System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString) +575
System.Data.Entity.Internal.LazyInternalConnection.TryInitializeFromAppConfig(String name, AppConfig config) +144 ... +21 System.Data.Entity.Infrastructure.DbQuery1.System.Linq.IQueryable.get_Provider() +44 System.Linq.Queryable.Where(IQueryable
1 source, Expression1 predicate) +85 AcusticoA3.Controllers.HomeController.Index() +978 lambda_method(Closure , ControllerBase , Object[]) +79
2 parameters) +264
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary2 parameters) +39
1 continuation) +727142 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList
System.Web.Mvc.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() +124 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func1 filters, ActionDescriptor actionDescriptor, IDictionary
2 parameters) +309
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +727076
System.Web.Mvc.Controller.ExecuteCore() +159
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +334 System.Web.Mvc.<>c_DisplayClassb.b_5() +62 System.Web.Mvc.Async.<>c_DisplayClass1.b_0() +15 System.Web.Mvc.<>c_DisplayClasse.b_d() +52
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +606 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288
我使用Mysql.connector 6.6.5.0和5.0的EntityFramework。
我的ConnectionString:
<connectionStrings>
<add name="MyEntities" connectionString="metadata=res://*/Models.Model.csdl|res://*/Models.Model.ssdl|res://*/Models.Model.msl;provider=MySql.Data.MySqlClient;provider connection string="server=[HOST];user id=[USER]; password=[PASSWORD]; database=[DATABASE]"" providerName="System.Data.EntityClient"/> </connectionStrings>
你能張貼'MySql.Data實施.MySqlClient'?也許嘗試'提供者= System.Data.SqlClient'而不是? – rae1
「無法找到數據提供」可能意味着MySQL提供程序未安裝在服務器上,不是? –
嗨,這是我的代碼: using(var db = new MyEntities()){ //錯誤在這裏發生。 ViewBag.BookData =(從db.book中的t where t.Date> = currentData select t).Take(2); } –