Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Azure 从web api项目中加入数据库时出现异常_Azure_Asp.net Web Api_Azure Sql Database - Fatal编程技术网

Azure 从web api项目中加入数据库时出现异常

Azure 从web api项目中加入数据库时出现异常,azure,asp.net-web-api,azure-sql-database,Azure,Asp.net Web Api,Azure Sql Database,在尝试查询数据库时,我突然遇到以下异常 Application: 2014-03-27T20:56:01 PID[15096] Error Error Getting user with id : 885151 Exception : System.Data.Entity.Core.EntityException: The underlying provider failed on Open. ---> System.Data.SqlClient.SqlException:

在尝试查询数据库时,我突然遇到以下异常

Application: 2014-03-27T20:56:01  PID[15096] Error       Error Getting user with id : 885151 Exception : System.Data.Entity.Core.EntityException: The underlying provider failed on Open. ---> System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - An attempt was made to access a socket in a way forbidden by its access permissions.) ---> System.ComponentModel.Win32Exception: An attempt was made to access a socket in a way forbidden by its access permissions
Application:    --- End of inner exception stack trace ---
Application:    at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
Application:    at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
Application:    at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean withFailover)
Application:    at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover)
Application:    at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout)
Application:    at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance)
Application:    at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData)
Application:    at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
Application:    at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
Application:    at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
Application:    at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
Application:    at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
Application:    at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
Application:    at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
Application:    at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
Application:    at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
Application:    at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
Application:    at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
Application:    at System.Data.SqlClient.SqlConnection.Open()
Application:    at System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.<Open>b__38(DbConnection t, DbConnectionInterceptionContext c)
Application:    at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext](TTarget target, Action`2 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)
Application:    at System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.Open(DbConnection connection, DbInterceptionContext interceptionContext)
Application:    at System.Data.Entity.Core.EntityClient.EntityConnection.<Open>b__2()
Application:    at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.<>c__DisplayClass1.<Execute>b__0()
Application:    at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func`1 operation)
Application:    at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute(Action operation)
Application:    at System.Data.Entity.Core.EntityClient.EntityConnection.Open()
Application:    --- End of inner exception stack trace ---
Application:    at System.Data.Entity.Core.EntityClient.EntityConnection.Open()
Application:    at System.Data.Entity.Core.Objects.ObjectContext.EnsureConnection(Boolean shouldMonitorTransactions)
Application:    at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
Application:    at System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClass7.<GetResults>b__5()
Application:    at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func`1 operation)
Application:    at System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
Application:    at System.Data.Entity.Core.Objects.ObjectQuery`1.<System.Collections.Generic.IEnumerable<T>.GetEnumerator>b__0()
Application:    at System.Data.Entity.Internal.LazyEnumerator`1.MoveNext()
Application:    at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source)
Application:    at System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.<GetElementFunction>b__2[TResult](IEnumerable`1 sequence)
Application:    at System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.ExecuteSingle[TResult](IEnumerable`1 query, Expression queryRoot)
Application:    at System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider.Execute[TResult](Expression expression)
Application:    at System.Data.Entity.Internal.Linq.DbQueryProvider.Execute[TResult](Expression expression)
Application:    at System.Linq.Queryable.SingleOrDefault[TSource](IQueryable`1 source)
Application:    at ServerMapping.Dal.GetUser(String externalID)
Application:    at TasteItWebSite.Controllers.LoginApiController.Get(String id)
应用程序:2014-03-27T20:56:01 PID[15096]获取id为885151的用户时出错异常:System.Data.Entity.Core.EntityException:基础提供程序在打开时失败。-->System.Data.SqlClient.SqlException:建立到SQL Server的连接时发生与网络相关或特定于实例的错误。找不到服务器或无法访问服务器。验证实例名称是否正确,以及SQL Server是否配置为允许远程连接。(提供程序:TCP提供程序,错误:0-试图以其访问权限所禁止的方式访问套接字。)-->System.ComponentModel.Win32异常:试图以其访问权限所禁止的方式访问套接字
应用程序:---内部异常堆栈跟踪的结束---
应用程序:位于System.Data.SqlClient.SqlInternalConnection.OneError(SqlException异常、布尔断开连接、操作'1 wrapCloseInAction)
应用程序:位于System.Data.SqlClient.TdsParser.ThroweException和Warning(TdsParserStateObject stateObj、布尔调用方连接锁、布尔异步关闭)
应用程序:位于System.Data.SqlClient.TdsParser.Connect(ServerInfo ServerInfo、SqlInternalConnectionDS connHandler、布尔值IgnoresInOpenTimeout、Int64 TimerSpire、布尔值加密、布尔值trustServerCert、布尔值集成安全性、布尔值带故障切换)
应用程序:位于System.Data.SqlClient.SqlInternalConnectionDS.AttemptOneLogin(ServerInfo ServerInfo、String newPassword、SecureString newSecurePassword、Boolean IgnoresInOpenTimeout、TimeoutTimer timeout、Boolean withFailover)
应用程序:位于System.Data.SqlClient.SqlInternalConnectionDs.LoginOfAirver(ServerInfo服务器信息、字符串新密码、SecureString newSecurePassword、布尔重定向声明、SqlConnectionString连接选项、SqlCredential凭证、超时超时)
应用程序:位于System.Data.SqlClient.SqlInternalConnectionDS.OpenLoginList(超时超时超时、SqlConnectionString连接选项、SqlCredential凭据、字符串新密码、SecureString NewSecurePrePassword、布尔重定向EduceResistance)
应用程序:位于System.Data.SqlClient.SqlInternalConnectionDS..ctor(DbConnectionPoolIdentity标识、SqlConnectionString连接选项、SqlCredential凭据、对象提供程序信息、字符串新密码、SecureString newSecurePassword、布尔重定向声明、SqlConnectionString用户连接选项、SessionData重新连接SessionData)
应用程序:位于System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions选项、DbConnectionPoolKey poolKey、Object poolGroupProviderInfo、DbConnectionPool池、DbConnectionOwningConnection、DbConnectionOptions用户选项)
应用程序:位于System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool池、DbConnection owningObject、DbConnectionOptions选项、DbConnectionPoolKey poolKey、DbConnectionOptions用户选项)
应用程序:位于System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection-owningObject、DbConnectionOptions-userOptions、DbConnectionInternal-oldConnection)
应用程序:位于System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject、DbConnectionOptions userOptions、DbConnectionInternal oldConnection)
应用程序:位于System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject、UInt32 WaitForMultipleObjectsStimOut、布尔allowCreate、布尔OnlyOnEckConnection、DbConnectionOptions用户选项、DbConnectionInternal和connection)
应用程序:位于System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject、TaskCompletionSource`1重试、DbConnectionOptions用户选项、DbConnectionInternal和connection)
应用程序:位于System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection、TaskCompletionSource`1重试、DbConnectionOptions用户选项、DbConnectionInternal oldConnection、DbConnectionInternal&connection)
应用程序:位于System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection、DbConnectionFactory connectionFactory、TaskCompletionSource`1重试、DbConnectionOptions用户选项)
应用程序:位于System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection,DbConnectionFactory connectionFactory,TaskCompletionSource`1重试,DbConnectionOptions用户选项)
应用程序:位于System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1重试)
应用程序:位于System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1重试)
应用程序:at System.Data.SqlClient.SqlConnection.Open()
应用程序:at System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.b_uu38(DbConnection t,DbConnectionInterceptionContext c)
应用程序:at System.Data.Entity.Infrastructure.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext](TTarget目标,Action`2操作,TInterceptionContext拦截context,Action`3执行,Action`3执行)
应用程序:at System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.Open(DbConnection-connection,DbInterceptionContext-interceptionContext)
应用程序:at System.Data.Entity.Core.EntityClient.EntityConnection.b__2()
应用程序:在System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.c__DisplayClass1.b__0()中
应用程序:在System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func`1操作)
应用程序:位于System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute(操作操作)
应用程序:在System.Data.Entity.Core.EntityClient.EntityConnection.Open()中
应用程序:---内部异常堆栈跟踪的结束---
应用程序:位于System.Data.Entity.Core.EntityClient.EntityConnect