You are showing Exception.Message ? As a developer it's best to keep Exception.ToString() somewhere so that you have the inner exception(s) as well which would likely better help in knowing why it fails.
For now we can ,just guess (a wrong default connection string maybe ?)
Thanks for this option. we have validated the connection string. Its correct.
I am adding entire error message. Please let me know if this helps.
*************************************
Server Error in '/PROJECT' Application.
The system cannot find the file specifiedDescription: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ComponentModel.Win32Exception: The system cannot find the file specified
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[Win32Exception (0x80004005): The system cannot find the file specified] [SqlException (0x80131904): 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: SQL Network Interfaces, error: 52 - Unable to locate a Local Database Runtime installation. Verify that SQL Server Express is properly installed and
that the Local Database Runtime feature is enabled.)] System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString
newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling) +1394 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions
options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) +1120 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection
owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) +70 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
+964 System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +114 System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32
waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) +1631 System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1
retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +117 System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal
oldConnection, DbConnectionInternal& connection) +267 System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
+318 System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry) +211 System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) +393 System.Data.SqlClient.SqlConnection.Open() +122 System.Data.SqlClient.SqlProviderServices.UsingConnection(SqlConnection
sqlConnection, Action`1 act) +99 System.Data.SqlClient.SqlProviderServices.UsingMasterConnection(SqlConnection sqlConnection, Action`1 act) +608 System.Data.SqlClient.SqlProviderServices.GetDbProviderManifestToken(DbConnection connection) +353 System.Data.Common.DbProviderServices.GetProviderManifestToken(DbConnection
connection) +26 [ProviderIncompatibleException: The provider did not return a ProviderManifestToken string.] System.Data.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection) +182 System.Data.Entity.ModelConfiguration.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices
providerServices, DbConnection connection) +32 [ProviderIncompatibleException: An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string. Check the inner exceptions for
details and ensure that the connection string is correct.] System.Data.Entity.ModelConfiguration.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices providerServices, DbConnection connection) +208 System.Data.Entity.ModelConfiguration.Utilities.DbConnectionExtensions.GetProviderInfo(DbConnection
connection, DbProviderManifest& providerManifest) +46 System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection) +61 System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext) +85 System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput
input) +227 System.Data.Entity.Internal.LazyInternalContext.InitializeContext() +628 System.Data.Entity.Internal.InternalContext.CreateObjectContextForDdlOps() +23 System.Data.Entity.Database.Exists() +38 MvcApplication1.Filters.SimpleMembershipInitializer..ctor()
+137 [InvalidOperationException: The ASP.NET Simple Membership database could not be initialized. For more information, please see
http://go.microsoft.com/fwlink/?LinkId=256588] MvcApplication1.Filters.SimpleMembershipInitializer..ctor() +403 [TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0 System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis,
Boolean fillCache, StackCrawlMark& stackMark) +138 System.Activator.CreateInstance(Type type, Boolean nonPublic) +105 System.Activator.CreateInstance(Type type) +12 System.Threading.LazyHelpers`1.ActivatorFactorySelector() +60 System.Threading.LazyInitializer.EnsureInitializedCore(T&
target, Boolean& initialized, Object& syncLock, Func`1 valueFactory) +137 System.Threading.LazyInitializer.EnsureInitialized(T& target, Boolean& initialized, Object& syncLock) +137 System.Web.Mvc.Async.AsyncControllerActionInvoker.InvokeActionMethodFilterAsynchronously(IActionFilter
filter, ActionExecutingContext preContext, Func`1 nextInChain) +100 System.Web.Mvc.Async.AsyncControllerActionInvoker.InvokeActionMethodFilterAsynchronously(IActionFilter filter, ActionExecutingContext preContext, Func`1 nextInChain) +801 System.Web.Mvc.Async.<>c__DisplayClass37.<BeginInvokeActionMethodWithFilters>b__31(AsyncCallback
asyncCallback, Object asyncState) +270 System.Web.Mvc.Async.WrappedAsyncResult`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +171 System.Web.Mvc.Async.AsyncControllerActionInvoker.BeginInvokeActionMethodWithFilters(ControllerContext controllerContext,
IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters, AsyncCallback callback, Object state) +271 System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__1e(AsyncCallback asyncCallback, Object asyncState) +774 System.Web.Mvc.Async.WrappedAsyncResult`1.Begin(AsyncCallback
callback, Object state, Int32 timeout) +171 System.Web.Mvc.Async.AsyncControllerActionInvoker.BeginInvokeAction(ControllerContext controllerContext, String actionName, AsyncCallback callback, Object state) +410 System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__17(AsyncCallback
asyncCallback, Object asyncState) +46 System.Web.Mvc.Async.WrappedAsyncResult`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +171 System.Web.Mvc.Controller.BeginExecuteCore(AsyncCallback callback, Object state) +539 System.Web.Mvc.Async.WrappedAsyncResult`1.Begin(AsyncCallback
callback, Object state, Int32 timeout) +171 System.Web.Mvc.Controller.BeginExecute(RequestContext requestContext, AsyncCallback callback, Object state) +464 System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__2(AsyncCallback asyncCallback, Object asyncState)
+127 System.Web.Mvc.Async.WrappedAsyncResult`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +171 System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +342 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
+921 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +137
[Win32Exception (0x80004005): The system cannot find the file specified] [SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server.
Generally, this issue is related to the following causes:
firewall settings from the web server to the database server
connection string errors
enable the appropriate protocol pipes/ tcp-ip
You could refer to the following article to troubleshoot Connecting to the SQL Server Database Engine:
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
None
0 Points
3 Posts
Unable to connect my asp.net mvc web application to the sql server after deploying it to IIS7
Nov 27, 2018 12:24 PM|manishmjoshi|LINK
Hi,
I am trying to deploy an application on IIS. I am using .Net MVC 4.
In debug mode its working, post I deploy on the IIS its giving following error
"The ASP.Net simple membership database could not be initialized"
Can anyone pls suggest what should I check?
Thanks.
All-Star
48670 Points
18169 Posts
Re: Unable to connect my asp.net mvc web application to the sql server after deploying it to IIS7
Nov 27, 2018 12:29 PM|PatriceSc|LINK
Hi,
You are showing Exception.Message ? As a developer it's best to keep Exception.ToString() somewhere so that you have the inner exception(s) as well which would likely better help in knowing why it fails.
For now we can ,just guess (a wrong default connection string maybe ?)
None
0 Points
3 Posts
Re: Unable to connect my asp.net mvc web application to the sql server after deploying it to IIS7
Nov 27, 2018 12:52 PM|manishmjoshi|LINK
Thanks for this option. we have validated the connection string. Its correct.
I am adding entire error message. Please let me know if this helps.
*************************************
Server Error in '/PROJECT' Application.
The system cannot find the file specified Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.ComponentModel.Win32Exception: The system cannot find the file specified Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[Win32Exception (0x80004005): The system cannot find the file specified] [SqlException (0x80131904): 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: SQL Network Interfaces, error: 52 - Unable to locate a Local Database Runtime installation. Verify that SQL Server Express is properly installed and that the Local Database Runtime feature is enabled.)] System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling) +1394 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) +1120 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) +70 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +964 System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +114 System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) +1631 System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +117 System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) +267 System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +318 System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry) +211 System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) +393 System.Data.SqlClient.SqlConnection.Open() +122 System.Data.SqlClient.SqlProviderServices.UsingConnection(SqlConnection sqlConnection, Action`1 act) +99 System.Data.SqlClient.SqlProviderServices.UsingMasterConnection(SqlConnection sqlConnection, Action`1 act) +608 System.Data.SqlClient.SqlProviderServices.GetDbProviderManifestToken(DbConnection connection) +353 System.Data.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection) +26 [ProviderIncompatibleException: The provider did not return a ProviderManifestToken string.] System.Data.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection) +182 System.Data.Entity.ModelConfiguration.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices providerServices, DbConnection connection) +32 [ProviderIncompatibleException: An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string. Check the inner exceptions for details and ensure that the connection string is correct.] System.Data.Entity.ModelConfiguration.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices providerServices, DbConnection connection) +208 System.Data.Entity.ModelConfiguration.Utilities.DbConnectionExtensions.GetProviderInfo(DbConnection connection, DbProviderManifest& providerManifest) +46 System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection) +61 System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext) +85 System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input) +227 System.Data.Entity.Internal.LazyInternalContext.InitializeContext() +628 System.Data.Entity.Internal.InternalContext.CreateObjectContextForDdlOps() +23 System.Data.Entity.Database.Exists() +38 MvcApplication1.Filters.SimpleMembershipInitializer..ctor() +137 [InvalidOperationException: The ASP.NET Simple Membership database could not be initialized. For more information, please see http://go.microsoft.com/fwlink/?LinkId=256588] MvcApplication1.Filters.SimpleMembershipInitializer..ctor() +403 [TargetInvocationException: Exception has been thrown by the target of an invocation.] System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0 System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +138 System.Activator.CreateInstance(Type type, Boolean nonPublic) +105 System.Activator.CreateInstance(Type type) +12 System.Threading.LazyHelpers`1.ActivatorFactorySelector() +60 System.Threading.LazyInitializer.EnsureInitializedCore(T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory) +137 System.Threading.LazyInitializer.EnsureInitialized(T& target, Boolean& initialized, Object& syncLock) +137 System.Web.Mvc.Async.AsyncControllerActionInvoker.InvokeActionMethodFilterAsynchronously(IActionFilter filter, ActionExecutingContext preContext, Func`1 nextInChain) +100 System.Web.Mvc.Async.AsyncControllerActionInvoker.InvokeActionMethodFilterAsynchronously(IActionFilter filter, ActionExecutingContext preContext, Func`1 nextInChain) +801 System.Web.Mvc.Async.<>c__DisplayClass37.<BeginInvokeActionMethodWithFilters>b__31(AsyncCallback asyncCallback, Object asyncState) +270 System.Web.Mvc.Async.WrappedAsyncResult`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +171 System.Web.Mvc.Async.AsyncControllerActionInvoker.BeginInvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters, AsyncCallback callback, Object state) +271 System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__1e(AsyncCallback asyncCallback, Object asyncState) +774 System.Web.Mvc.Async.WrappedAsyncResult`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +171 System.Web.Mvc.Async.AsyncControllerActionInvoker.BeginInvokeAction(ControllerContext controllerContext, String actionName, AsyncCallback callback, Object state) +410 System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__17(AsyncCallback asyncCallback, Object asyncState) +46 System.Web.Mvc.Async.WrappedAsyncResult`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +171 System.Web.Mvc.Controller.BeginExecuteCore(AsyncCallback callback, Object state) +539 System.Web.Mvc.Async.WrappedAsyncResult`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +171 System.Web.Mvc.Controller.BeginExecute(RequestContext requestContext, AsyncCallback callback, Object state) +464 System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__2(AsyncCallback asyncCallback, Object asyncState) +127 System.Web.Mvc.Async.WrappedAsyncResult`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +171 System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +342 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +921 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +137
************************************
All-Star
45489 Points
7008 Posts
Microsoft
Re: Unable to connect my asp.net mvc web application to the sql server after deploying it to IIS7
Nov 29, 2018 02:04 AM|Zhi Lv - MSFT|LINK
Hi
Generally, this issue is related to the following causes:
You could refer to the following article to troubleshoot Connecting to the SQL Server Database Engine:
How to Troubleshoot Connecting to the SQL Server Database Engine
SQL Server not found
Best regards,
Dillion
None
0 Points
3 Posts
Re: Unable to connect my asp.net mvc web application to the sql server after deploying it to IIS7
Nov 29, 2018 04:25 AM|manishmjoshi|LINK
Thanks for this information. I will refer to the article you have mentioned.
Thank you !
- Manish