Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Published Before All Okay...Published at Weekend Had Issue -Resolved...Publish Update Monday and Getting 500 Infernal Error

$
0
0

First let me make clear this code hasn't changed from the previous few iterations of publication.  My project is large and I am working to create stuff, test locally, publish to a protected site have my staff test it and return comment on changes to make it easier for them to use.  Consequently I have published more than a dozen times I would think without issue.

Suddenly I am having all sorts of bother.

One issue I have traced to a date setting which I will look at later as I don't think that is impacting me now.  To work around the date issue in the seed data I backed up and restored my local database to the host.

After a bit of mucking about I found if I leave the connection to the host and test the application locally it is throwing an error on:

  public static void Initialize(Eva804Context context)
        {
                           context.Database.EnsureCreated();
           blah,blah,blah

The error being returned is:

{System.ArgumentException: Keyword not supported: 'datasource'.
   at System.Data.Common.DbConnectionOptions.ParseInternal(Dictionary`2 parsetable, String connectionString, Boolean buildChain, Dictionary`2 synonyms)
   at System.Data.Common.DbConnectionOptions..ctor(String connectionString, Dictionary`2 synonyms)
   at System.Data.SqlClient.SqlConnectionString..ctor(String connectionString)
   at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous)
   at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions)
   at System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key)
   at System.Data.SqlClient.SqlConnection.set_ConnectionString(String value)
   at Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerConnection.CreateDbConnection()
   at Microsoft.EntityFrameworkCore.Internal.LazyRef`1.get_Value()
   at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.Open()
   at Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerDatabaseCreator.<>c__DisplayClass11_0.<Exists>b__0(DateTime giveUp)
   at Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerExecutionStrategy.Execute[TState,TResult](Func`2 operation, Func`2 verifySucceeded, TState state)
   at Microsoft.EntityFrameworkCore.ExecutionStrategyExtensions.Execute[TState,TResult](IExecutionStrategy strategy, Func`2 operation, TState state)
   at Microsoft.EntityFrameworkCore.Storage.RelationalDatabaseCreator.EnsureCreated()
   at Eva804.Models.DbInitializer.Initialize(Eva804Context context) in D:\sps\EVA\Current120617\Eva804\src\Eva804\Data\DbInitializer.cs:line 13
   at Eva804.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, Eva804Context context) in D:\sps\EVA\Current120617\Eva804\src\Eva804\Startup.cs:line 79}

If I tell the code to continue it returns:

System.IO.FileNotFoundException
Could not load the specified file.

I placed a try catch around the error to see what would happen.  This moves the error to:

 if (context.Location.Any())
            {
                return; //DB seeded
            }

Which then pops a more helpful 500 infernal error of:

System.ArgumentException
Keyword not supported: 'datasource'.

However this is confusing to me.  All I have done is passed the connection strings as provided by the web host as:

"ConnectionStrings": {"DefaultConnection": "DataSource=SQL5036.myWindowsHosting.com;Initial,Catalog=DB_A1941E_shentonTest;User,Id=Test_admin;Password=xxxxx;"
},

and then in On Configuring I have:

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlServer("DataSource=SQL5036.myWindowsHosting.com;Initial,Catalog=DB_A1941E_shentonTest;User,Id=Test_admin;Password=xxxxx;");
}

I am not sure where to look in the code for the cause of the error.

On publishing what is happening is:

- Refuses to load seed data - know the cause of this being the date format I need to fix

- Pops 500 Infernal Error and the error log created on the web server is an empty text file with no messages

I am sorry if my question seems vague to clarify.

- Am I looking at the correct error?

- Is there anything that is wrong with the datasource that worked perfectly the day before?

- Any guidance on steps to take to find this infernal error?


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>