当我从本地计算机运行项目时,我可以很好地连接到数据库。当我发布它时,我收到一个错误(下面)。我认为这个问题与应用程序池有关,但不能解决问题。弄清楚它是什么。
这是一切的全新安装,直到操作系统
身份 - applicationpoolidentity
连接字符串
<add name="SPA_Impact_Reporting_TestEntities" connectionString="metadata=res://*/newRack.csdl|res://*/newRack.ssdl|res://*/newRack.msl;provider=System.Data.SqlClient;provider connection string="data source=serverip;initial catalog=dbname;persist security info=True;user id=user;password=pass;MultipleActiveResultSets=T rue;App=EntityFramework"" providerName="System.Data.EntityClient" /></connectionStrings>
ERROR
流程信息: 进程ID:5872 进程名称:w3wp.exe 帐户名称:IIS APPPOOL \ DefaultAppPool
异常信息:
异常类型:SqlException
异常消息:建立与SQL Server的连接时发生与网络相关或特定于实例的错误。服务器未找到或无法访问。验证实例名称是否正确,以及SQL Server是否配置为允许远程连接。 (提供者:命名管道提供程序,错误:40 - 无法打开与SQL Server的连接)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception,Boolean breakConnection,Action 1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean withFailover)
at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover)
at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout)
at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource
1 retry,DbConnectionOptions userOptions,DbConnectionInternal&amp; connection)
在System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection,TaskCompletionSource 1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource
1重试,DbConnectionOptions userOptions)
在System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource 1 retry)
at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource
1重试)
在System.Data.SqlClient.SqlConnection.Open()
at System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition,DbConnection storeConnectionToOpen,DbConnection originalConnection,String exceptionCode,String attemptsOperation,Boolean&amp; closeStoreConnectionOnFailure)
找不到网络路径
Server Error in '/spadashboard' Application.
超时已过期。从池中获取连接之前经过的超时时间。这可能是因为所有池连接都在使用中并且达到了最大池大小。
描述:执行当前Web请求期间发生了未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。
异常详细信息:System.InvalidOperationException:超时已过期。从池中获取连接之前经过的超时时间。这可能是因为所有池连接都在使用中并且达到了最大池大小。
来源错误:
在执行当前Web请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪来识别有关异常的起源和位置的信息。
堆栈追踪:
[InvalidOperationException:超时已过期。从池中获取连接之前经过的超时时间。这可能是因为所有池连接都在使用中并且达到了最大池大小。
System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection,TaskCompletionSource 1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) +6600161
System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource
1 retry,DbConnectionOptions userOptions)+6600667
System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource 1 retry) +233
System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource
1次重试)+278
System.Data.SqlClient.SqlConnection.Open()+239
System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition,DbConnection storeConnectionToOpen,DbConnection originalConnection,String exceptionCode,String attemptsOperation,Boolean&amp; closeStoreConnectionOnFailure)+99
[EntityException:底层提供程序在Open上失败。]
System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition,DbConnection storeConnectionToOpen,DbConnection originalConnection,String exceptionCode,String attemptsOperation,Boolean&amp; closeStoreConnectionOnFailure)+10948975
System.Data.EntityClient.EntityConnection.Open()+ 136
System.Data.Objects.ObjectContext.EnsureConnection()+91
System.Data.Objects.ObjectContext.ExecuteStoreQueryInternal(String commandText,String entitySetName,MergeOption mergeOption,Object [] parameters)+109
System.Data.Objects.ObjectContext.ExecuteStoreQuery(String commandText,Object [] parameters)+87
System.Data.Entity.Internal.InternalContext.ExecuteSqlQuery(String sql,Object []参数)+118
System.Data.Entity.Internal.InternalContext.ExecuteSqlQueryAsIEnumerable(String sql,Object []参数)+85
System.Data.Entity.Internal.InternalContext.ExecuteSqlQuery(Type elementType,String sql,Object [] parameters)+260
System.Data.Entity.Internal.InternalSqlNonSetQuery.GetEnumerator()+34
System.Data.Entity.Internal.InternalSqlQuery 1.GetEnumerator() +28
System.Linq.Enumerable.FirstOrDefault(IEnumerable
1 source)+220
SPADash.Controllers.AccountsController.checkLogin(usrlogin cred)+151
lambda_method(Closure,ControllerBase,Object [])+127
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext,IDictionary 2 parameters) +242
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary
2个参数)+39
System.Web.Mvc.Async.AsyncControllerActionInvoker.b__39(IAsyncResult asyncResult,ActionInvocation innerInvokeState)+12
System.Web.Mvc.Async.WrappedAsyncResult 2.CallEndDelegate(IAsyncResult asyncResult) +139
System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() +112
System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +452
System.Web.Mvc.Async.<>c__DisplayClass33.<BeginInvokeActionMethodWithFilters>b__32(IAsyncResult asyncResult) +15
System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +37
System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +241
System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +29
System.Web.Mvc.Async.WrappedAsyncVoid
1.CallEndDelegate(IAsyncResult asyncResult)+111
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)+74
System.Web.Mvc.Async.WrappedAsyncVoid 1.CallEndDelegate(IAsyncResult asyncResult) +19
System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +51
System.Web.Mvc.Async.WrappedAsyncVoid
1.CallEndDelegate(IAsyncResult asyncResult)+111
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()+606
System.Web.HttpApplication.ExecuteStep(IExecutionStep step,Boolean&amp; completedSynchronously)+288
版本信息:Microsoft .NET Framework版本:4.0.30319; ASP.NET版本:4.0.30319.34212
答案 0 :(得分:1)
好的,让我们尝试将应用程序池标识从“AppPoolIdentity”更改为“LocalSystem”或“NetworkService”。看看是否会导致问题消失
更改它去运行&gt;&gt; inetmgr并按下
你应该看到你的iis控制台。
在你的左手上你可以看到应用程序池通过鼠标点击它,在屏幕右边你可以看到设置应用程序池默认点击它会弹出一个新窗口,其中包含很多属性 身份并选择本地系统或网络服务,如果您在计算机上选择本地服务用户帐户,请确保您在已发布的文件夹上授予本地服务权限