Connect C# MVC Source Code to localhost Database
up vote
-2
down vote
favorite
I am starting a job at a new company and i'm supposed to start using a system developed in .net core MVC by someone else.
I have a local copy of the database and a local copy of the code.
I can acces the SQL server DataBase and make my own SQL requests in SQL Server 2014, unfortunatly i cannot connect my Visual Studio code to my database and make everything work locally.
I tryed to load "ViewsHomeIndex.cshtml", the page starts to load at "localhost:45896" and after a few seconds i get the bellow error:
It appears the path is not properly written in the json file, but i am not sure how to write it any other way.
Or maybe something else.
Connection String:
"ConnectionStrings": {
"DefaultConnection": "Server=/SQLExpress;Database=something_article;User
Id=admins;Password=Admin;",
"EntityFrameworkConnection": "data source=172.16.10.5;initial catalog=companyname_common;persist security info=True;user
id=admin;password=azerty;MultipleActiveResultSets=True;App=EntityFramework""
},
Thank you
Best regards
Rui
An error occurred while starting the application. Win32Exception: Le
chemin d’accès spécifié n’est pas valide
Unknown location SqlException: Une erreur liée au réseau ou spécifique
à l'instance s'est produite lors de l'établissement d'une connexion à
SQL Server. Le serveur est introuvable ou n'est pas accessible.
Vérifiez que le nom de l'instance est correct et que SQL Server est
configuré pour autoriser les connexions distantes. (provider: Named
Pipes Provider, error: 40 - Impossible d'ouvrir une connexion à SQL
Server)
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity
identity, SqlConnectionString connectionOptions, SqlCredential
credential, object providerInfo, string newPassword, SecureString
newSecurePassword, bool redirectedUserInstance, SqlConnectionString
userConnectionOptions, SessionData reconnectSessionData,
DbConnectionPool pool, string accessToken, bool
applyTransientFaultHandling)
Win32Exception: Le chemin d’accès spécifié n’est pas valide
System.ComponentModel.Win32Exception (0x80004005): Le chemin d’accès
spécifié n’est pas valide
SqlException: Une erreur liée au réseau ou spécifique à l'instance
s'est produite lors de l'établissement d'une connexion à SQL Server.
Le serveur est introuvable ou n'est pas accessible. Vérifiez que le
nom de l'instance est correct et que SQL Server est configuré pour
autoriser les connexions distantes. (provider: Named Pipes Provider,
error: 40 - Impossible d'ouvrir une connexion à SQL Server)
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity
identity, SqlConnectionString connectionOptions, SqlCredential
credential, object providerInfo, string newPassword, SecureString
newSecurePassword, bool redirectedUserInstance, SqlConnectionString
userConnectionOptions, SessionData reconnectSessionData,
DbConnectionPool pool, string accessToken, bool
applyTransientFaultHandling)
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions
options, DbConnectionPoolKey poolKey, object poolGroupProviderInfo,
DbConnectionPool pool, DbConnection owningConnection,
DbConnectionOptions userOptions)
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool
pool, DbConnection owningObject, DbConnectionOptions options,
DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
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, uint waitForMultipleObjectsTimeout, bool allowCreate,
bool onlyOneCheckConnection, DbConnectionOptions userOptions, out
DbConnectionInternal connection)
System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection
owningObject, TaskCompletionSource retry,
DbConnectionOptions userOptions, out DbConnectionInternal connection)
System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection
owningConnection, TaskCompletionSource retry,
DbConnectionOptions userOptions, DbConnectionInternal oldConnection,
out DbConnectionInternal connection)
System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection
outerConnection, DbConnectionFactory connectionFactory,
TaskCompletionSource retry, DbConnectionOptions
userOptions)
System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource
retry)
System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource
retry)
System.Data.SqlClient.SqlConnection.Open()
Hangfire.SqlServer.SqlServerStorage.CreateAndOpenConnection()
Hangfire.SqlServer.SqlServerStorage.UseConnection(DbConnection dedicatedConnection, Func func)
Hangfire.SqlServer.SqlServerStorage.UseConnection(DbConnection dedicatedConnection, Action action)
Hangfire.SqlServer.SqlServerStorage.Initialize()
Hangfire.SqlServer.SqlServerStorage..ctor(string nameOrConnectionString, SqlServerStorageOptions options)
Hangfire.SqlServerStorageExtensions.UseSqlServerStorage(IGlobalConfiguration
configuration, string nameOrConnectionString, SqlServerStorageOptions
options)
SofedisWebsite.Startup.b__4_6(IGlobalConfiguration
m) in Startup.cs
m.UseSqlServerStorage(Configuration.GetConnectionString("DefaultConnection"),
new SqlServerStorageOptions()
Hangfire.HangfireServiceCollectionExtensions+<>c__DisplayClass1_0.b__10(IGlobalConfiguration
config)
Hangfire.HangfireServiceCollectionExtensions.GetInitializedJobStorage(IServiceProvider
serviceProvider)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactoryService(FactoryService
factoryService, ServiceProvider provider)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor.VisitCallSite(IServiceCallSite
callSite, TArgument argument)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite
scopedCallSite, ServiceProvider provider)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite
singletonCallSite, ServiceProvider provider)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor.VisitCallSite(IServiceCallSite
callSite, TArgument argument)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(IServiceCallSite
callSite, ServiceProvider provider)
Microsoft.Extensions.DependencyInjection.ServiceProvider+<>c__DisplayClass16_0.b__0(ServiceProvider
provider)
Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type
serviceType)
Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider
provider, Type serviceType)
Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider
provider)
Hangfire.HangfireApplicationBuilderExtensions.UseHangfireServer(IApplicationBuilder
app, BackgroundJobServerOptions options,
IEnumerable additionalProcesses, JobStorage
storage) SofedisWebsite.Startup.Configure(IApplicationBuilder app,
IHostingEnvironment env, ILoggerFactory loggerFactory,
IApplicationLifetime appLifetime, FileServerProvider
fileServerprovider) in Startup.cs
app.UseHangfireServer(new BackgroundJobServerOptions()
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder
app)
Microsoft.AspNetCore.Server.IISIntegration.IISSetupFilter+<>c__DisplayClass3_0.b__0(IApplicationBuilder
app)
Microsoft.AspNetCore.Hosting.Internal.AutoRequestServicesStartupFilter+<>c__DisplayClass0_0.b__0(IApplicationBuilder
builder)
Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
.NET Framework X64 v4.0.30319.42000 |
Microsoft.AspNetCore.Hosting version 1.1.1 | Microsoft Windows
10.0.10586 | Need help?
c# asp.net json model-view-controller aspnetcoretemplatepack
add a comment |
up vote
-2
down vote
favorite
I am starting a job at a new company and i'm supposed to start using a system developed in .net core MVC by someone else.
I have a local copy of the database and a local copy of the code.
I can acces the SQL server DataBase and make my own SQL requests in SQL Server 2014, unfortunatly i cannot connect my Visual Studio code to my database and make everything work locally.
I tryed to load "ViewsHomeIndex.cshtml", the page starts to load at "localhost:45896" and after a few seconds i get the bellow error:
It appears the path is not properly written in the json file, but i am not sure how to write it any other way.
Or maybe something else.
Connection String:
"ConnectionStrings": {
"DefaultConnection": "Server=/SQLExpress;Database=something_article;User
Id=admins;Password=Admin;",
"EntityFrameworkConnection": "data source=172.16.10.5;initial catalog=companyname_common;persist security info=True;user
id=admin;password=azerty;MultipleActiveResultSets=True;App=EntityFramework""
},
Thank you
Best regards
Rui
An error occurred while starting the application. Win32Exception: Le
chemin d’accès spécifié n’est pas valide
Unknown location SqlException: Une erreur liée au réseau ou spécifique
à l'instance s'est produite lors de l'établissement d'une connexion à
SQL Server. Le serveur est introuvable ou n'est pas accessible.
Vérifiez que le nom de l'instance est correct et que SQL Server est
configuré pour autoriser les connexions distantes. (provider: Named
Pipes Provider, error: 40 - Impossible d'ouvrir une connexion à SQL
Server)
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity
identity, SqlConnectionString connectionOptions, SqlCredential
credential, object providerInfo, string newPassword, SecureString
newSecurePassword, bool redirectedUserInstance, SqlConnectionString
userConnectionOptions, SessionData reconnectSessionData,
DbConnectionPool pool, string accessToken, bool
applyTransientFaultHandling)
Win32Exception: Le chemin d’accès spécifié n’est pas valide
System.ComponentModel.Win32Exception (0x80004005): Le chemin d’accès
spécifié n’est pas valide
SqlException: Une erreur liée au réseau ou spécifique à l'instance
s'est produite lors de l'établissement d'une connexion à SQL Server.
Le serveur est introuvable ou n'est pas accessible. Vérifiez que le
nom de l'instance est correct et que SQL Server est configuré pour
autoriser les connexions distantes. (provider: Named Pipes Provider,
error: 40 - Impossible d'ouvrir une connexion à SQL Server)
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity
identity, SqlConnectionString connectionOptions, SqlCredential
credential, object providerInfo, string newPassword, SecureString
newSecurePassword, bool redirectedUserInstance, SqlConnectionString
userConnectionOptions, SessionData reconnectSessionData,
DbConnectionPool pool, string accessToken, bool
applyTransientFaultHandling)
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions
options, DbConnectionPoolKey poolKey, object poolGroupProviderInfo,
DbConnectionPool pool, DbConnection owningConnection,
DbConnectionOptions userOptions)
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool
pool, DbConnection owningObject, DbConnectionOptions options,
DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
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, uint waitForMultipleObjectsTimeout, bool allowCreate,
bool onlyOneCheckConnection, DbConnectionOptions userOptions, out
DbConnectionInternal connection)
System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection
owningObject, TaskCompletionSource retry,
DbConnectionOptions userOptions, out DbConnectionInternal connection)
System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection
owningConnection, TaskCompletionSource retry,
DbConnectionOptions userOptions, DbConnectionInternal oldConnection,
out DbConnectionInternal connection)
System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection
outerConnection, DbConnectionFactory connectionFactory,
TaskCompletionSource retry, DbConnectionOptions
userOptions)
System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource
retry)
System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource
retry)
System.Data.SqlClient.SqlConnection.Open()
Hangfire.SqlServer.SqlServerStorage.CreateAndOpenConnection()
Hangfire.SqlServer.SqlServerStorage.UseConnection(DbConnection dedicatedConnection, Func func)
Hangfire.SqlServer.SqlServerStorage.UseConnection(DbConnection dedicatedConnection, Action action)
Hangfire.SqlServer.SqlServerStorage.Initialize()
Hangfire.SqlServer.SqlServerStorage..ctor(string nameOrConnectionString, SqlServerStorageOptions options)
Hangfire.SqlServerStorageExtensions.UseSqlServerStorage(IGlobalConfiguration
configuration, string nameOrConnectionString, SqlServerStorageOptions
options)
SofedisWebsite.Startup.b__4_6(IGlobalConfiguration
m) in Startup.cs
m.UseSqlServerStorage(Configuration.GetConnectionString("DefaultConnection"),
new SqlServerStorageOptions()
Hangfire.HangfireServiceCollectionExtensions+<>c__DisplayClass1_0.b__10(IGlobalConfiguration
config)
Hangfire.HangfireServiceCollectionExtensions.GetInitializedJobStorage(IServiceProvider
serviceProvider)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactoryService(FactoryService
factoryService, ServiceProvider provider)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor.VisitCallSite(IServiceCallSite
callSite, TArgument argument)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite
scopedCallSite, ServiceProvider provider)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite
singletonCallSite, ServiceProvider provider)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor.VisitCallSite(IServiceCallSite
callSite, TArgument argument)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(IServiceCallSite
callSite, ServiceProvider provider)
Microsoft.Extensions.DependencyInjection.ServiceProvider+<>c__DisplayClass16_0.b__0(ServiceProvider
provider)
Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type
serviceType)
Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider
provider, Type serviceType)
Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider
provider)
Hangfire.HangfireApplicationBuilderExtensions.UseHangfireServer(IApplicationBuilder
app, BackgroundJobServerOptions options,
IEnumerable additionalProcesses, JobStorage
storage) SofedisWebsite.Startup.Configure(IApplicationBuilder app,
IHostingEnvironment env, ILoggerFactory loggerFactory,
IApplicationLifetime appLifetime, FileServerProvider
fileServerprovider) in Startup.cs
app.UseHangfireServer(new BackgroundJobServerOptions()
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder
app)
Microsoft.AspNetCore.Server.IISIntegration.IISSetupFilter+<>c__DisplayClass3_0.b__0(IApplicationBuilder
app)
Microsoft.AspNetCore.Hosting.Internal.AutoRequestServicesStartupFilter+<>c__DisplayClass0_0.b__0(IApplicationBuilder
builder)
Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
.NET Framework X64 v4.0.30319.42000 |
Microsoft.AspNetCore.Hosting version 1.1.1 | Microsoft Windows
10.0.10586 | Need help?
c# asp.net json model-view-controller aspnetcoretemplatepack
Maybe you can take a look in your MVC application at a file called Web.config and locate the <connectionStrings> and make sure it points to your localdb?
– mb14
Nov 22 at 14:12
My web.config file has no "ConnectionString" in it. :(
– Rui Ruivo
Nov 22 at 14:20
add a comment |
up vote
-2
down vote
favorite
up vote
-2
down vote
favorite
I am starting a job at a new company and i'm supposed to start using a system developed in .net core MVC by someone else.
I have a local copy of the database and a local copy of the code.
I can acces the SQL server DataBase and make my own SQL requests in SQL Server 2014, unfortunatly i cannot connect my Visual Studio code to my database and make everything work locally.
I tryed to load "ViewsHomeIndex.cshtml", the page starts to load at "localhost:45896" and after a few seconds i get the bellow error:
It appears the path is not properly written in the json file, but i am not sure how to write it any other way.
Or maybe something else.
Connection String:
"ConnectionStrings": {
"DefaultConnection": "Server=/SQLExpress;Database=something_article;User
Id=admins;Password=Admin;",
"EntityFrameworkConnection": "data source=172.16.10.5;initial catalog=companyname_common;persist security info=True;user
id=admin;password=azerty;MultipleActiveResultSets=True;App=EntityFramework""
},
Thank you
Best regards
Rui
An error occurred while starting the application. Win32Exception: Le
chemin d’accès spécifié n’est pas valide
Unknown location SqlException: Une erreur liée au réseau ou spécifique
à l'instance s'est produite lors de l'établissement d'une connexion à
SQL Server. Le serveur est introuvable ou n'est pas accessible.
Vérifiez que le nom de l'instance est correct et que SQL Server est
configuré pour autoriser les connexions distantes. (provider: Named
Pipes Provider, error: 40 - Impossible d'ouvrir une connexion à SQL
Server)
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity
identity, SqlConnectionString connectionOptions, SqlCredential
credential, object providerInfo, string newPassword, SecureString
newSecurePassword, bool redirectedUserInstance, SqlConnectionString
userConnectionOptions, SessionData reconnectSessionData,
DbConnectionPool pool, string accessToken, bool
applyTransientFaultHandling)
Win32Exception: Le chemin d’accès spécifié n’est pas valide
System.ComponentModel.Win32Exception (0x80004005): Le chemin d’accès
spécifié n’est pas valide
SqlException: Une erreur liée au réseau ou spécifique à l'instance
s'est produite lors de l'établissement d'une connexion à SQL Server.
Le serveur est introuvable ou n'est pas accessible. Vérifiez que le
nom de l'instance est correct et que SQL Server est configuré pour
autoriser les connexions distantes. (provider: Named Pipes Provider,
error: 40 - Impossible d'ouvrir une connexion à SQL Server)
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity
identity, SqlConnectionString connectionOptions, SqlCredential
credential, object providerInfo, string newPassword, SecureString
newSecurePassword, bool redirectedUserInstance, SqlConnectionString
userConnectionOptions, SessionData reconnectSessionData,
DbConnectionPool pool, string accessToken, bool
applyTransientFaultHandling)
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions
options, DbConnectionPoolKey poolKey, object poolGroupProviderInfo,
DbConnectionPool pool, DbConnection owningConnection,
DbConnectionOptions userOptions)
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool
pool, DbConnection owningObject, DbConnectionOptions options,
DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
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, uint waitForMultipleObjectsTimeout, bool allowCreate,
bool onlyOneCheckConnection, DbConnectionOptions userOptions, out
DbConnectionInternal connection)
System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection
owningObject, TaskCompletionSource retry,
DbConnectionOptions userOptions, out DbConnectionInternal connection)
System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection
owningConnection, TaskCompletionSource retry,
DbConnectionOptions userOptions, DbConnectionInternal oldConnection,
out DbConnectionInternal connection)
System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection
outerConnection, DbConnectionFactory connectionFactory,
TaskCompletionSource retry, DbConnectionOptions
userOptions)
System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource
retry)
System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource
retry)
System.Data.SqlClient.SqlConnection.Open()
Hangfire.SqlServer.SqlServerStorage.CreateAndOpenConnection()
Hangfire.SqlServer.SqlServerStorage.UseConnection(DbConnection dedicatedConnection, Func func)
Hangfire.SqlServer.SqlServerStorage.UseConnection(DbConnection dedicatedConnection, Action action)
Hangfire.SqlServer.SqlServerStorage.Initialize()
Hangfire.SqlServer.SqlServerStorage..ctor(string nameOrConnectionString, SqlServerStorageOptions options)
Hangfire.SqlServerStorageExtensions.UseSqlServerStorage(IGlobalConfiguration
configuration, string nameOrConnectionString, SqlServerStorageOptions
options)
SofedisWebsite.Startup.b__4_6(IGlobalConfiguration
m) in Startup.cs
m.UseSqlServerStorage(Configuration.GetConnectionString("DefaultConnection"),
new SqlServerStorageOptions()
Hangfire.HangfireServiceCollectionExtensions+<>c__DisplayClass1_0.b__10(IGlobalConfiguration
config)
Hangfire.HangfireServiceCollectionExtensions.GetInitializedJobStorage(IServiceProvider
serviceProvider)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactoryService(FactoryService
factoryService, ServiceProvider provider)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor.VisitCallSite(IServiceCallSite
callSite, TArgument argument)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite
scopedCallSite, ServiceProvider provider)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite
singletonCallSite, ServiceProvider provider)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor.VisitCallSite(IServiceCallSite
callSite, TArgument argument)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(IServiceCallSite
callSite, ServiceProvider provider)
Microsoft.Extensions.DependencyInjection.ServiceProvider+<>c__DisplayClass16_0.b__0(ServiceProvider
provider)
Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type
serviceType)
Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider
provider, Type serviceType)
Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider
provider)
Hangfire.HangfireApplicationBuilderExtensions.UseHangfireServer(IApplicationBuilder
app, BackgroundJobServerOptions options,
IEnumerable additionalProcesses, JobStorage
storage) SofedisWebsite.Startup.Configure(IApplicationBuilder app,
IHostingEnvironment env, ILoggerFactory loggerFactory,
IApplicationLifetime appLifetime, FileServerProvider
fileServerprovider) in Startup.cs
app.UseHangfireServer(new BackgroundJobServerOptions()
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder
app)
Microsoft.AspNetCore.Server.IISIntegration.IISSetupFilter+<>c__DisplayClass3_0.b__0(IApplicationBuilder
app)
Microsoft.AspNetCore.Hosting.Internal.AutoRequestServicesStartupFilter+<>c__DisplayClass0_0.b__0(IApplicationBuilder
builder)
Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
.NET Framework X64 v4.0.30319.42000 |
Microsoft.AspNetCore.Hosting version 1.1.1 | Microsoft Windows
10.0.10586 | Need help?
c# asp.net json model-view-controller aspnetcoretemplatepack
I am starting a job at a new company and i'm supposed to start using a system developed in .net core MVC by someone else.
I have a local copy of the database and a local copy of the code.
I can acces the SQL server DataBase and make my own SQL requests in SQL Server 2014, unfortunatly i cannot connect my Visual Studio code to my database and make everything work locally.
I tryed to load "ViewsHomeIndex.cshtml", the page starts to load at "localhost:45896" and after a few seconds i get the bellow error:
It appears the path is not properly written in the json file, but i am not sure how to write it any other way.
Or maybe something else.
Connection String:
"ConnectionStrings": {
"DefaultConnection": "Server=/SQLExpress;Database=something_article;User
Id=admins;Password=Admin;",
"EntityFrameworkConnection": "data source=172.16.10.5;initial catalog=companyname_common;persist security info=True;user
id=admin;password=azerty;MultipleActiveResultSets=True;App=EntityFramework""
},
Thank you
Best regards
Rui
An error occurred while starting the application. Win32Exception: Le
chemin d’accès spécifié n’est pas valide
Unknown location SqlException: Une erreur liée au réseau ou spécifique
à l'instance s'est produite lors de l'établissement d'une connexion à
SQL Server. Le serveur est introuvable ou n'est pas accessible.
Vérifiez que le nom de l'instance est correct et que SQL Server est
configuré pour autoriser les connexions distantes. (provider: Named
Pipes Provider, error: 40 - Impossible d'ouvrir une connexion à SQL
Server)
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity
identity, SqlConnectionString connectionOptions, SqlCredential
credential, object providerInfo, string newPassword, SecureString
newSecurePassword, bool redirectedUserInstance, SqlConnectionString
userConnectionOptions, SessionData reconnectSessionData,
DbConnectionPool pool, string accessToken, bool
applyTransientFaultHandling)
Win32Exception: Le chemin d’accès spécifié n’est pas valide
System.ComponentModel.Win32Exception (0x80004005): Le chemin d’accès
spécifié n’est pas valide
SqlException: Une erreur liée au réseau ou spécifique à l'instance
s'est produite lors de l'établissement d'une connexion à SQL Server.
Le serveur est introuvable ou n'est pas accessible. Vérifiez que le
nom de l'instance est correct et que SQL Server est configuré pour
autoriser les connexions distantes. (provider: Named Pipes Provider,
error: 40 - Impossible d'ouvrir une connexion à SQL Server)
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity
identity, SqlConnectionString connectionOptions, SqlCredential
credential, object providerInfo, string newPassword, SecureString
newSecurePassword, bool redirectedUserInstance, SqlConnectionString
userConnectionOptions, SessionData reconnectSessionData,
DbConnectionPool pool, string accessToken, bool
applyTransientFaultHandling)
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions
options, DbConnectionPoolKey poolKey, object poolGroupProviderInfo,
DbConnectionPool pool, DbConnection owningConnection,
DbConnectionOptions userOptions)
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool
pool, DbConnection owningObject, DbConnectionOptions options,
DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
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, uint waitForMultipleObjectsTimeout, bool allowCreate,
bool onlyOneCheckConnection, DbConnectionOptions userOptions, out
DbConnectionInternal connection)
System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection
owningObject, TaskCompletionSource retry,
DbConnectionOptions userOptions, out DbConnectionInternal connection)
System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection
owningConnection, TaskCompletionSource retry,
DbConnectionOptions userOptions, DbConnectionInternal oldConnection,
out DbConnectionInternal connection)
System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection
outerConnection, DbConnectionFactory connectionFactory,
TaskCompletionSource retry, DbConnectionOptions
userOptions)
System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource
retry)
System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource
retry)
System.Data.SqlClient.SqlConnection.Open()
Hangfire.SqlServer.SqlServerStorage.CreateAndOpenConnection()
Hangfire.SqlServer.SqlServerStorage.UseConnection(DbConnection dedicatedConnection, Func func)
Hangfire.SqlServer.SqlServerStorage.UseConnection(DbConnection dedicatedConnection, Action action)
Hangfire.SqlServer.SqlServerStorage.Initialize()
Hangfire.SqlServer.SqlServerStorage..ctor(string nameOrConnectionString, SqlServerStorageOptions options)
Hangfire.SqlServerStorageExtensions.UseSqlServerStorage(IGlobalConfiguration
configuration, string nameOrConnectionString, SqlServerStorageOptions
options)
SofedisWebsite.Startup.b__4_6(IGlobalConfiguration
m) in Startup.cs
m.UseSqlServerStorage(Configuration.GetConnectionString("DefaultConnection"),
new SqlServerStorageOptions()
Hangfire.HangfireServiceCollectionExtensions+<>c__DisplayClass1_0.b__10(IGlobalConfiguration
config)
Hangfire.HangfireServiceCollectionExtensions.GetInitializedJobStorage(IServiceProvider
serviceProvider)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactoryService(FactoryService
factoryService, ServiceProvider provider)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor.VisitCallSite(IServiceCallSite
callSite, TArgument argument)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite
scopedCallSite, ServiceProvider provider)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite
singletonCallSite, ServiceProvider provider)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor.VisitCallSite(IServiceCallSite
callSite, TArgument argument)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(IServiceCallSite
callSite, ServiceProvider provider)
Microsoft.Extensions.DependencyInjection.ServiceProvider+<>c__DisplayClass16_0.b__0(ServiceProvider
provider)
Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type
serviceType)
Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider
provider, Type serviceType)
Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider
provider)
Hangfire.HangfireApplicationBuilderExtensions.UseHangfireServer(IApplicationBuilder
app, BackgroundJobServerOptions options,
IEnumerable additionalProcesses, JobStorage
storage) SofedisWebsite.Startup.Configure(IApplicationBuilder app,
IHostingEnvironment env, ILoggerFactory loggerFactory,
IApplicationLifetime appLifetime, FileServerProvider
fileServerprovider) in Startup.cs
app.UseHangfireServer(new BackgroundJobServerOptions()
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder
app)
Microsoft.AspNetCore.Server.IISIntegration.IISSetupFilter+<>c__DisplayClass3_0.b__0(IApplicationBuilder
app)
Microsoft.AspNetCore.Hosting.Internal.AutoRequestServicesStartupFilter+<>c__DisplayClass0_0.b__0(IApplicationBuilder
builder)
Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
.NET Framework X64 v4.0.30319.42000 |
Microsoft.AspNetCore.Hosting version 1.1.1 | Microsoft Windows
10.0.10586 | Need help?
c# asp.net json model-view-controller aspnetcoretemplatepack
c# asp.net json model-view-controller aspnetcoretemplatepack
edited Nov 22 at 14:15
asked Nov 22 at 14:09
Rui Ruivo
337
337
Maybe you can take a look in your MVC application at a file called Web.config and locate the <connectionStrings> and make sure it points to your localdb?
– mb14
Nov 22 at 14:12
My web.config file has no "ConnectionString" in it. :(
– Rui Ruivo
Nov 22 at 14:20
add a comment |
Maybe you can take a look in your MVC application at a file called Web.config and locate the <connectionStrings> and make sure it points to your localdb?
– mb14
Nov 22 at 14:12
My web.config file has no "ConnectionString" in it. :(
– Rui Ruivo
Nov 22 at 14:20
Maybe you can take a look in your MVC application at a file called Web.config and locate the <connectionStrings> and make sure it points to your localdb?
– mb14
Nov 22 at 14:12
Maybe you can take a look in your MVC application at a file called Web.config and locate the <connectionStrings> and make sure it points to your localdb?
– mb14
Nov 22 at 14:12
My web.config file has no "ConnectionString" in it. :(
– Rui Ruivo
Nov 22 at 14:20
My web.config file has no "ConnectionString" in it. :(
– Rui Ruivo
Nov 22 at 14:20
add a comment |
2 Answers
2
active
oldest
votes
up vote
0
down vote
add connection string in web config
inside configuration
tag
<connectionStrings>
<add name="connectionname"
connectionString="Server=localhost; Database=dbname;
Integrated Security=True"; providerName="System.Data.SqlClient" />
</connectionStrings>
and for reading that connection string use this: -
System.Configuration.ConfigurationManager.
ConnectionStrings["connectionname"].ConnectionString;
add a comment |
up vote
-1
down vote
Configure your Connection string TAG in the Web.config file.
User for example the site below:
https://www.connectionstrings.com/
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
add connection string in web config
inside configuration
tag
<connectionStrings>
<add name="connectionname"
connectionString="Server=localhost; Database=dbname;
Integrated Security=True"; providerName="System.Data.SqlClient" />
</connectionStrings>
and for reading that connection string use this: -
System.Configuration.ConfigurationManager.
ConnectionStrings["connectionname"].ConnectionString;
add a comment |
up vote
0
down vote
add connection string in web config
inside configuration
tag
<connectionStrings>
<add name="connectionname"
connectionString="Server=localhost; Database=dbname;
Integrated Security=True"; providerName="System.Data.SqlClient" />
</connectionStrings>
and for reading that connection string use this: -
System.Configuration.ConfigurationManager.
ConnectionStrings["connectionname"].ConnectionString;
add a comment |
up vote
0
down vote
up vote
0
down vote
add connection string in web config
inside configuration
tag
<connectionStrings>
<add name="connectionname"
connectionString="Server=localhost; Database=dbname;
Integrated Security=True"; providerName="System.Data.SqlClient" />
</connectionStrings>
and for reading that connection string use this: -
System.Configuration.ConfigurationManager.
ConnectionStrings["connectionname"].ConnectionString;
add connection string in web config
inside configuration
tag
<connectionStrings>
<add name="connectionname"
connectionString="Server=localhost; Database=dbname;
Integrated Security=True"; providerName="System.Data.SqlClient" />
</connectionStrings>
and for reading that connection string use this: -
System.Configuration.ConfigurationManager.
ConnectionStrings["connectionname"].ConnectionString;
answered Nov 23 at 5:27
Yash Soni
45010
45010
add a comment |
add a comment |
up vote
-1
down vote
Configure your Connection string TAG in the Web.config file.
User for example the site below:
https://www.connectionstrings.com/
add a comment |
up vote
-1
down vote
Configure your Connection string TAG in the Web.config file.
User for example the site below:
https://www.connectionstrings.com/
add a comment |
up vote
-1
down vote
up vote
-1
down vote
Configure your Connection string TAG in the Web.config file.
User for example the site below:
https://www.connectionstrings.com/
Configure your Connection string TAG in the Web.config file.
User for example the site below:
https://www.connectionstrings.com/
answered Nov 22 at 18:32
Angelo Simonato
113
113
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53432791%2fconnect-c-sharp-mvc-source-code-to-localhost-database%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Maybe you can take a look in your MVC application at a file called Web.config and locate the <connectionStrings> and make sure it points to your localdb?
– mb14
Nov 22 at 14:12
My web.config file has no "ConnectionString" in it. :(
– Rui Ruivo
Nov 22 at 14:20