Hi,
I've tried to publish my ASPNETZERO-core application to my hosting provider with their provided settings file using VS2017. After the publishing of the website show success, when I try to access the site, I get the following error:
An error occurred while starting the application.
.NET Core X64 v4.1.1.0 | Microsoft.AspNetCore.Hosting version 1.1.2 | Microsoft Windows 6.3.9600
The hosting company provided me with an extract of an error file:
Application startup exception: System.ArgumentException: Keyword not supported: '"data source'.
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.RelationalConnection.BeginTransaction(IsolationLevel isolationLevel)
at Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerExecutionStrategy.Execute[TState,TResult](Func`WebDep2 operation, Func`2 verifySucceeded, TState state)
at Abp.EntityFrameworkCore.Uow.DbContextEfCoreTransactionStrategy.CreateDbContext[TDbContext](String connectionString, IDbContextResolver dbContextResolver)
at Abp.EntityFrameworkCore.Uow.EfCoreUnitOfWork.GetOrCreateDbContext[TDbContext](Nullable`1 multiTenancySide)
at MyApp.Migrations.Seed.SeedHelper.WithDbContext[TDbContext](IIocResolver iocResolver, Action`1 contextAction) in C:\Users\User\Source\Repos\MyApp\src\MyApp.EntityFrameworkCore\Migrations\Seed\SeedHelper.cs:line 40
at System.Collections.Generic.List`1.ForEach(Action`1 action)
at Abp.AbpBootstrapper.Initialize()
at Abp.AspNetCore.AbpApplicationBuilderExtensions.UseAbp(IApplicationBuilder app)
at MyApp.MyApp.Web.Startup.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) in C:\Users\User\Source\Repos\MyApp\src\MyApp.Web.Mvc\Startup\Startup.cs:line 94
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)
at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
Hosting environment: Production
Content root path: h:\root\home\benborries-001\www\ppdev
Now listening on: http://localhost:10111
Application started. Press Ctrl+C to shut down.
I checked the appsettings.json file for the connection string and it appears to be in order:
{
"ConnectionStrings": {
"Default": "Server=HOSTINGPROVIDER.SQL;Database=HOSTING_DB;User Id=MY_HOSTING_USER;Password=THE_PASSWORD;"
},
"Abp": {
"RedisCache": {
"ConnectionString": "localhost",
"DatabaseId": -1
}
},
"App": {
"WebSiteRootAddress": "http://{TENANCY_NAME}.dev.mydomain.xyz/"
},
"Authentication": {
"Facebook": {
"IsEnabled": "false",
"AppId": "",
"AppSecret": ""
},
"Google": {
"IsEnabled": "false",
"ClientId": "",
"ClientSecret": ""
},
"Twitter": {
"IsEnabled": "false",
"ConsumerKey": "",
"ConsumerSecret": ""
},
"Microsoft": {
"IsEnabled": "false",
"ConsumerKey": "",
"ConsumerSecret": ""
},
"JwtBearer": {
"IsEnabled": "true",
"SecurityKey": "REMOVED",
"Issuer": "REMOVED",
"Audience": "REMOVED"
},
"OpenId": {
"IsEnabled": "false",
"Authority": "",
"ClientId": "",
"ClientSecret": ""
}
},
"Recaptcha": {
"SiteKey": "REMOVED",
"SecretKey": "REMOVED"
}
}
When I developed locally I used the MigratorApp to initialiase and seed the database, but on the hosting provider this appear not be be possible.
Any ideas to what the cause might be why I'm getting this?
I tried to run the app without and DB inistialiesd locally, but EFCore does not create the local DB for me. (The hosted DB, without the required tables, is already created by the hosting company)
Any assistance would be greatly appreciated.
Thx,
Riaan
3 Answer(s)
-
0
Hi,
Your first problem is related to connection string as you know. Before fixing that, you need to create your db using migrations.
We only have migrator tool for that but I couldn't understand why you couldn't use it. If you have access to SQL DB from your computer, you can run migrator on your PC.
-
0
<cite>ismcagdas: </cite> Hi,
Your first problem is related to connection string as you know. Before fixing that, you need to create your db using migrations.
We only have migrator tool for that but I couldn't understand why you couldn't use it. If you have access to SQL DB from your computer, you can run migrator on your PC.
Hi,
Thanks. I managed to get this working. The issue was that the DB tables was not created after the deploy as you suggested.
What I did was to change the MigratorTool's datasource to the website's DB (hosted) and run the migrator, which created the tables for me and resolved our issue.
Thanks.
-
0
Great :)