Azure中的网站提供数据库连接错误

时间:2014-11-28 12:14:13

标签: mysql asp.net-mvc azure azure-sql-database mysql-error-1064

我刚将我的MVC5网络项目移至Azure。该项目使用MySql数据库,该数据库现在也在Azure中托管。我已经更新了连接字符串,如果我在自己的机器上从localhost启动网站(仍然指向Azure上的数据库)一切正常。但是,如果我从Azure url启动网站,则会出现sql错误。

  

System.Data.Entity.Core.ProviderIncompatibleException:提供者   没有返回ProviderManifestToken字符串。 ---&GT;   MySql.Data.MySqlClient.MySqlException:无法连接到任何一个   指定的MySQL主机。 ---&GT; System.Net.Sockets.SocketException:An   尝试以访问禁止的方式访问套接字   权限127.0.0.1:3306 at   System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)at   MySql.Data.Common.MyNetworkStream.CreateSocketStream(MySqlConnectionStringBuilder   设置,IPAddress ip,布尔unix)at   MySql.Data.Common.MyNetworkStream.CreateStream(MySqlConnectionStringBuilder   设置,布尔unix)at   MySql.Data.Common.StreamCreator.GetStream(MySqlConnectionStringBuilder   设置)在MySql.Data.MySqlClient.NativeDriver.Open()---结束   内部异常堆栈跟踪--- at   MySql.Data.MySqlClient.NativeDriver.Open()at   MySql.Data.MySqlClient.Driver.Open()at   MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder   设置)在MySql.Data.MySqlClient.MySqlPool.GetPooledConnection()at   MySql.Data.MySqlClient.MySqlPool.TryToGetDriver()at   MySql.Data.MySqlClient.MySqlPool.GetConnection()at   MySql.Data.MySqlClient.MySqlConnection.Open()at   MySql.Data.MySqlClient.MySqlProviderServices.GetDbProviderManifestToken(的DbConnection   连接)   System.Data.Entity.Core.Common.DbProviderServices.GetProviderManifestToken(的DbConnection   连接)---内部异常堆栈跟踪结束--- at   System.Data.Entity.Core.Common.DbProviderServices.GetProviderManifestToken(的DbConnection   连接)   System.Data.Entity.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices   providerServices,DbConnection连接)---内部异常结束   堆栈跟踪--- at   System.Data.Entity.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices   providerServices,DbConnection连接)at   System.Data.Entity.Infrastructure.DefaultManifestTokenResolver&LT;&GT; c__DisplayClass1.b__0(元组3 k) at System.Collections.Concurrent.ConcurrentDictionary 2.GetOrAdd(TKEY的   key,Func 2 valueFactory) at System.Data.Entity.Infrastructure.DefaultManifestTokenResolver.ResolveManifestToken(DbConnection connection) at System.Data.Entity.Utilities.DbConnectionExtensions.GetProviderInfo(DbConnection connection, DbProviderManifest& providerManifest) at System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection) at System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext) at System.Data.Entity.Internal.RetryLazy 2.GetValue(TInput input)at   System.Data.Entity.Internal.LazyInternalContext.InitializeContext()at   System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(类型   entityType)at   System.Data.Entity.Internal.Linq.InternalSet 1.Initialize() at System.Data.Entity.Internal.Linq.InternalSet 1.Include(String path)at   System.Data.Entity.Infrastructure.DbQuery 1.Include(String path) at System.Data.Entity.QueryableExtensions.Include[T](IQueryable 1个来源,   字符串路径)   System.Data.Entity.QueryableExtensions.Include [T,TProperty](IQueryable 1 source, Expression 1路径)at at   Microsoft.AspNet.Identity.EntityFramework.UserStore 6.GetUserAggregateAsync(Expression 1   过滤器)   Microsoft.AspNet.Identity.EntityFramework.UserStore 6.FindByNameAsync(String userName) at Microsoft.AspNet.Identity.UserManager 2.FindByNameAsync(字符串   userName)at   Microsoft.AspNet.Identity.Owin.SignInManager 2.<PasswordSignInAsync>d__29.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at tripplanner.Controllers.AccountController.<Login>d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Mvc.Async.TaskAsyncActionDescriptor.EndExecute(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass37.<BeginInvokeAsynchronousActionMethod>b__36(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult 1.CallEndDelegate(IAsyncResult的   asyncResult)at   System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase 1.End() at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass33.<BeginInvokeActionMethodWithFilters>b__32(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult 1.CallEndDelegate(IAsyncResult的   asyncResult)at   System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()   在   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult的   asyncResult)at   System.Web.Mvc.Async.AsyncControllerActionInvoker&LT;&GT; c__DisplayClass21&LT;&GT; c__DisplayClass2b.b__1c()   在   System.Web.Mvc.Async.AsyncControllerActionInvoker&LT;&GT; c__DisplayClass21.b__1e(IAsyncResult的   asyncResult);

希望有人可以提供帮助。

更新:我在Azure中使用了错误的web.config文件。

0 个答案:

没有答案