System.ArgumentException: ''Server' is an invalid connection string attribute'

Alan 41 Reputation points
2022-06-22T14:28:50.067+00:00

Hi, so I cloned the same project as my fellow devs, and I'm the only one who gets this error, preventing my blazor web assembly app not displaying any data. I think the problem is that my dbconnectionstring (second pic) is pointing to my localdb instead of the intended database in my connectionstring in appsettings (there is no 'server' in it) that I have set. Been stuck on this for weeks, any help will be appreciated, thanks.

213830-image.png

213897-image.png

System.ArgumentException
HResult=0x80070057
Message='Server' is an invalid connection string attribute
Source=Oracle.ManagedDataAccess
StackTrace:
at OracleInternal.ConnectionPool.ConnectionString.SetProperty(String key, String value, String quotedValue, String originalKey, SecureString secPasswd)
at OracleInternal.ConnectionPool.ConnectionString.Parse(OracleConnection con, String constr)
at OracleInternal.ConnectionPool.ConnectionString..ctor(OracleConnection con, String constring, OracleCredential credential, OracleAccessToken accessToken)
at OracleInternal.ConnectionPool.ConnectionString.GetCS(OracleConnection con, String constr, OracleCredential credential, OracleAccessToken accessToken, Boolean bCreateIfNotinCache)
at Oracle.ManagedDataAccess.Client.OracleConnection.set_ConnectionString(String value)
at Oracle.ManagedDataAccess.Client.OracleConnection..ctor(String connectionString)
at Oracle.EntityFrameworkCore.Storage.Internal.OracleRelationalConnection.CreateDbConnection()
at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.get_DbConnection()
at Oracle.EntityFrameworkCore.Storage.Internal.OracleRelationalCommandBuilderFactory.OracleRelationalCommandBuilder.OracleRelationalCommand.CreateDbCommand(RelationalCommandParameterObject parameterObject, Guid commandId, DbCommandMethod commandMethod)
at Oracle.EntityFrameworkCore.Storage.Internal.OracleRelationalCommandBuilderFactory.OracleRelationalCommandBuilder.OracleRelationalCommand.ExecuteNonQuery(RelationalCommandParameterObject parameterObject)
at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.ExecuteSqlRaw(DatabaseFacade databaseFacade, String sql, IEnumerable1 parameters) at X.Blazor.DBService.XOracleDAO1.ExecutePackage()
at X.Blazor.DBService.XOracleDAO`1..ctor(String vsPackageName, Boolean transaction)
at xx.Server.Controllers.CommonController.GetMyRespGroup() in C:\Dev\Azure\x.Server\Controllers\CommonController.cs:line 48
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<<InvokeActionMethodAsync>g__Logged|12_1>d.MoveNext()

This exception was originally thrown at this call stack:
[External Code]
x.Server.Controllers.CommonController.GetMyRespGroup() in CommonController.cs
[External Code]

Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,396 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,758 questions
0 comments No comments
{count} votes

Accepted answer
  1. Tom Phillips 17,716 Reputation points
    2022-06-22T14:35:56.627+00:00

    You are apparently trying to connect to an Oracle server with an Oracle driver, and your error is:
    'Server' is an invalid connection string attribute

    In order to connect to SQL Server you would also need to change the driver selected.


1 additional answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 56,766 Reputation points
    2022-06-22T15:25:10.417+00:00

    We can not see your code. Typically it’s a nuget package and set in code in dbcontext options. In you case you need to add the Sqlserver nuget package and replace UseOracle with UseSqlServer.

    Note: if there is Oracle only code, you may need to update to support Sqlserver

    0 comments No comments