none
The system cannot find the file specified Description RRS feed

  • Question

  • So I have developed an ASP.NET application which I deployed on Azure. I did connect my program to a database(and properly changed the Connection String), I did not do anything concerning migrations, and I have the following error:

    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, SqlAuthenticationProviderManager sqlAuthProviderManager) +1081 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) +803 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) +38 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +739 System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +85 System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) +449 System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +108 System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) +935 System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 retry, DbConnectionOptions userOptions) +143 System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 retry, DbConnectionOptions userOptions) +17 System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource1 retry) +139 System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource1 retry) +448 System.Data.SqlClient.SqlConnection.Open() +129 System.Data.Entity.Infrastructure.Interception.<>c.b__13_0(DbConnection t, DbConnectionInterceptionContext c) +12 System.Data.Entity.Infrastructure.Interception.InternalDispatcher1.Dispatch(TTarget target, Action2 operation, TInterceptionContext interceptionContext, Action3 executing, Action3 executed) +72 System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.Open(DbConnection connection, DbInterceptionContext interceptionContext) +424 System.Data.Entity.SqlServer.<>c__DisplayClass60_0.b__0() +426 System.Data.Entity.SqlServer.<>c__DisplayClass2_0.b__0() +10 System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute(Func1 operation) +189 System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute(Action operation) +78 System.Data.Entity.SqlServer.SqlProviderServices.UsingConnection(DbConnection sqlConnection, Action1 act) +175 System.Data.Entity.SqlServer.SqlProviderServices.UsingMasterConnection(DbConnection sqlConnection, Action1 act) +552 System.Data.Entity.SqlServer.SqlProviderServices.CreateDatabaseFromScript(Nullable1 commandTimeout, DbConnection sqlConnection, String createDatabaseScript) +90 System.Data.Entity.SqlServer.SqlProviderServices.DbCreateDatabase(DbConnection connection, Nullable1 commandTimeout, StoreItemCollection storeItemCollection) +173 System.Data.Entity.Core.Common.DbProviderServices.CreateDatabase(DbConnection connection, Nullable1 commandTimeout, StoreItemCollection storeItemCollection) +76 System.Data.Entity.Core.Objects.ObjectContext.CreateDatabase() +134 System.Data.Entity.Migrations.Utilities.DatabaseCreator.Create(DbConnection connection) +119 System.Data.Entity.Migrations.DbMigrator.EnsureDatabaseExists(Action mustSucceedToKeepDatabase) +142 System.Data.Entity.Migrations.DbMigrator.Update(String targetMigration) +78 System.Data.Entity.Internal.DatabaseCreator.CreateDatabase(InternalContext internalContext, Func3 createMigrator, ObjectContext objectContext) +89 System.Data.Entity.Internal.InternalContext.CreateDatabase(ObjectContext objectContext, DatabaseExistenceState existenceState) +116 System.Data.Entity.Database.Create(DatabaseExistenceState existenceState) +218 System.Data.Entity.CreateDatabaseIfNotExists1.InitializeDatabase(TContext context) +138 System.Data.Entity.Internal.<>c__DisplayClass66_01.<CreateInitializationAction>b__0() +76 System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action) +60 System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization() +357 System.Data.Entity.Internal.<>c.<InitializeDatabase>b__58_0(InternalContext c) +9 System.Data.Entity.Internal.RetryAction1.PerformAction(TInput input) +129 System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action1 action) +196 System.Data.Entity.Internal.LazyInternalContext.InitializeDatabase() +86 System.Data.Entity.Internal.InternalContext.Initialize() +30 System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +16 System.Data.Entity.Internal.Linq.InternalSet1.Initialize() +53 System.Data.Entity.Internal.Linq.InternalSet1.get_InternalContext() +15 System.Data.Entity.Infrastructure.DbQuery1.System.Linq.IQueryable.get_Provider() +38 System.Linq.Queryable.OrderBy(IQueryable1 source, Expression1 keySelector) +83 ProiectLicenta.Controllers.Main.ActorController.Index() in C:\ProiectLicenta\ProiectLicenta\Controllers\Main\ActorController.cs:25 lambda_method(Closure , ControllerBase , Object[] ) +62 System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +14 System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary2 parameters) +169 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary2 parameters) +27 System.Web.Mvc.Async.<>c.b__9_0(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +22 System.Web.Mvc.Async.WrappedAsyncResult2.CallEndDelegate(IAsyncResult asyncResult) +29 System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +49 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +32 System.Web.Mvc.Async.AsyncInvocationWithFilters.b__11_0() +50 System.Web.Mvc.Async.<>c__DisplayClass11_1.b__2() +228 System.Web.Mvc.Async.<>c__DisplayClass7_0.b__1(IAsyncResult asyncResult) +10 System.Web.Mvc.Async.WrappedAsyncResult1.CallEndDelegate(IAsyncResult asyncResult) +10 System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +49 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +34 System.Web.Mvc.Async.<>c__DisplayClass3_6.b__3() +35 System.Web.Mvc.Async.<>c__DisplayClass3_1.b__5(IAsyncResult asyncResult) +100 System.Web.Mvc.Async.WrappedAsyncResult1.CallEndDelegate(IAsyncResult asyncResult) +10 System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +49 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +27 System.Web.Mvc.<>c.b__152_1(IAsyncResult asyncResult, ExecuteCoreState innerState) +11 System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +29 System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +49 System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +45 System.Web.Mvc.<>c.b__151_2(IAsyncResult asyncResult, Controller controller) +13 System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +22 System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +49 System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +26 System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10 System.Web.Mvc.<>c.b__20_1(IAsyncResult asyncResult, ProcessRequestState innerState) +28 System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +29 System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +49 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +28 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +577 System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +132 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +163

    Meanwhile I've managed to fix my error and I would like to thank all for helping me out :).

    Monday, February 17, 2020 5:47 PM

Answers

  • Your connectionstring seems to be wrong. Maybe you connectionstring may be using Localdb or it pointing to MS SQL Server Express instance on your local machine, which I think is not going to work if you hosting the solution on the Azure platform. 

    Can you post the connectionstring you deployed with the application?

    Monday, February 17, 2020 6:41 PM
  • Hi Anne,

    Thank you for posting here.

    Based on my search, the following link seems to have the same error as yours, check that and maybe their solution is useful to you.

    The system cannot find the file specified

    System.ComponentModel.Win32Exception: The system cannot find the file specified

    Best Regards,

    Timon


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, February 18, 2020 3:23 AM
  • This exception:

    [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.)]

    Tells me you are probably trying to talk to a local DB instance (perhaps LocalDB or SQLExpress). Neither are available in Azure. You'll need to either set up a hybrid connection back to a SQL database on your internal network or put your data in an Azure database and connect to that. That is beyond the support in the C# forums so you'll need to post over in the Azure forums. Here's the starter docs.


    Michael Taylor http://www.michaeltaylorp3.net

    Tuesday, February 18, 2020 2:59 PM
    Moderator

All replies

  • Your connectionstring seems to be wrong. Maybe you connectionstring may be using Localdb or it pointing to MS SQL Server Express instance on your local machine, which I think is not going to work if you hosting the solution on the Azure platform. 

    Can you post the connectionstring you deployed with the application?

    Monday, February 17, 2020 6:41 PM
  • Hi Anne,

    Thank you for posting here.

    Based on my search, the following link seems to have the same error as yours, check that and maybe their solution is useful to you.

    The system cannot find the file specified

    System.ComponentModel.Win32Exception: The system cannot find the file specified

    Best Regards,

    Timon


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, February 18, 2020 3:23 AM
  • This exception:

    [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.)]

    Tells me you are probably trying to talk to a local DB instance (perhaps LocalDB or SQLExpress). Neither are available in Azure. You'll need to either set up a hybrid connection back to a SQL database on your internal network or put your data in an Azure database and connect to that. That is beyond the support in the C# forums so you'll need to post over in the Azure forums. Here's the starter docs.


    Michael Taylor http://www.michaeltaylorp3.net

    Tuesday, February 18, 2020 2:59 PM
    Moderator
  • Sure. here is it:

    Data Source=proiectlicenta20200210075530dbserver.database.windows.net;Initial Catalog=ProiectLicenta20200210075530_db;User ID=mariaabc;Password=password;Connect Timeout=30;Encrypt=True;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False

    I did write the password without the apostrophes, for eg if my password was annemarie then in the connection string it is "Password=annemarie;".

    I actually have 2 connection strings. This is what my connectionString tag in web config looks like:

      <connectionStrings>

        <add name="DBConnectionString" providerName="System.Data.SqlClient" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=C:\ProiectLicenta\ProiectLicenta\App_Data\aspnet-ProiectLicenta-20190902080329.mdf;Initial Catalog=aspnet-ProiectLicenta-20190902080329;Integrated Security=True" />

        <add name="DefaultConnection" connectionString="Data Source=proiectlicenta20200210075530dbserver.database.windows.net;Initial Catalog=ProiectLicenta20200210075530_db;User ID=mariaabc;Password=password;Connect Timeout=30;Encrypt=True;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False" providerName="System.Data.SqlClient" />
      </connectionStrings>



    Wednesday, February 19, 2020 10:46 AM