Posted by: ora - Tuesday, 12 December 2023 04:01:22
Hi, I've tried building and publishing on my CentOS 8 machine and while it compiles and runs, anytime I try to navigate to root or /install I'm getting the following error:
[code=markup]NoValidDbAccessProviderFoundException: Unable to Locate Provider Named "Microsoft.Data.SqlClient" in Data Access Providers (DLL Not Located in Bin Directory?).[/code]
I've tried changing permissions and starting directory. Neither works.
Posted by: tha_watcha - Tuesday, 12 December 2023 07:12:24
Looks like the provider dll was not copied to the bin folder. Issue has been fixed in the source repository.
Posted by: ora - Tuesday, 12 December 2023 11:31:24
Is there a similar issue with Postgres? I couldn't even get that one to build. (Sorry if this deserves its own thread)
Posted by: tha_watcha - Tuesday, 12 December 2023 11:45:34
Yes it's the same issue, and also already fixed. What build issues are you having?
Posted by: ora - Tuesday, 12 December 2023 21:06:21
I apologize, I misremembered. The issue is at first run not during build:
[code=markup]Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'Npgsql, Version=8.0.1.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7'. The system cannot find the file specified.[/code]
EDIT: Full build process if it helps: [url]https://paste.orawalters.com/121223-yaf.net-postgresql.sln-build[/url]
Posted by: tha_watcha - Wednesday, 13 December 2023 02:11:24
[quote=ora;73856]I apologize, I misremembered. The issue is at first run not during build:
[code=markup]Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'Npgsql, Version=8.0.1.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7'. The system cannot find the file specified.[/code]
EDIT: Full build process if it helps: [url]https://paste.orawalters.com/121223-yaf.net-postgresql.sln-build[/url][/quote]
No problem, the issue on first run is already resolved in the source repository.
Posted by: ora - Wednesday, 13 December 2023 02:49:57
I can confirm having pulled from master and rebuilt the issue is still there:
[code=markup][ora@s1 clubmoneyyaf]$ ls
appsettings.json Microsoft.AspNetCore.Authentication.Facebook.dll Newtonsoft.Json.Bson.dll System.Runtime.Caching.dll
Autofac.dll Microsoft.AspNetCore.Authentication.Google.dll Newtonsoft.Json.dll System.Security.Cryptography.ProtectedData.dll
Autofac.Extensions.DependencyInjection.dll Microsoft.AspNetCore.Identity.UI.dll OEmbed.Core.dll System.ServiceModel.Syndication.dll
Azure.Core.dll Microsoft.AspNetCore.JsonPatch.dll package.json tr
Azure.Identity.dll Microsoft.AspNetCore.Mvc.NewtonsoftJson.dll pl UAParser.Core.dll
BouncyCastle.Cryptography.dll Microsoft.AspNetCore.Mvc.Razor.Extensions.dll pt-BR UAParser.dll
cs Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation.dll publish web.config
de Microsoft.AspNetCore.Razor.Language.dll QRCoder.dll wwwroot
es Microsoft.Bcl.AsyncInterfaces.dll ru YAF
FarsiLibrary.Core.dll Microsoft.CodeAnalysis.CSharp.dll runtimes YAF.Configuration.dll
fr Microsoft.CodeAnalysis.dll ServiceStack.dll YAF.Configuration.pdb
Google.Authenticator.dll Microsoft.CodeAnalysis.Razor.dll ServiceStack.OrmLite.dll YAF.Core.dll
helpmenu.json Microsoft.Data.SqlClient.dll ServiceStack.OrmLite.PostgreSQL.dll YAF.Core.pdb
it Microsoft.Extensions.DependencyModel.dll ServiceStack.OrmLite.PostgreSQL.xml YAF.Data.PostgreSQL.dll
J2N.dll Microsoft.Identity.Client.dll ServiceStack.OrmLite.SqlServer.dll YAF.Data.PostgreSQL.pdb
ja Microsoft.Identity.Client.Extensions.Msal.dll ServiceStack.OrmLite.SqlServer.xml YAF.deps.json
ko Microsoft.IdentityModel.Abstractions.dll ServiceStack.OrmLite.xml YAF.dll
Lucene.Net.Analysis.Common.dll Microsoft.IdentityModel.JsonWebTokens.dll ServiceStack.xml YAF.pdb
Lucene.Net.dll Microsoft.IdentityModel.Logging.dll SixLabors.ImageSharp.dll YAF.runtimeconfig.json
Lucene.Net.Highlighter.dll Microsoft.IdentityModel.Protocols.dll System.ComponentModel.Composition.dll YAF.Types.dll
Lucene.Net.Memory.dll Microsoft.IdentityModel.Protocols.OpenIdConnect.dll System.Configuration.ConfigurationManager.dll YAF.Types.pdb
Lucene.Net.Queries.dll Microsoft.IdentityModel.Tokens.dll System.IdentityModel.Tokens.Jwt.dll YAF.Web.dll
Lucene.Net.QueryParser.dll Microsoft.SqlServer.Server.dll System.Linq.Async.dll YAF.Web.pdb
Lucene.Net.Sandbox.dll MimeKit.dll System.Memory.Data.dll zh-Hans
MailKit.dll mimeTypes.json System.Net.Http.Formatting.dll zh-Hant
[ora@s1 clubmoneyyaf]$ ./YAF
Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'Npgsql, Version=8.0.1.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7'. The system cannot find the file specified.
File name: 'Npgsql, Version=8.0.1.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7'
at YAF.Data.PostgreSQL.PostgreSQLModule.Load(ContainerBuilder builder)
at Autofac.Module.Configure(IComponentRegistryBuilder componentRegistry)
at Autofac.Core.Registration.ModuleRegistrar.<.ctor>b__1_0(IComponentRegistryBuilder reg)
at Autofac.ContainerBuilder.Build(IComponentRegistryBuilder componentRegistry, Boolean excludeDefaultModules)
at Autofac.ContainerBuilder.UpdateRegistry(IComponentRegistryBuilder componentRegistry)
at Autofac.Module.Configure(IComponentRegistryBuilder componentRegistry)
at Autofac.Core.Registration.ModuleRegistrar.<.ctor>b__1_0(IComponentRegistryBuilder reg)
at Autofac.ContainerBuilder.Build(IComponentRegistryBuilder componentRegistry, Boolean excludeDefaultModules)
at Autofac.ContainerBuilder.Build(ContainerBuildOptions options)
at Autofac.Extensions.DependencyInjection.AutofacServiceProviderFactory.CreateServiceProvider(ContainerBuilder containerBuilder)
at Microsoft.Extensions.Hosting.HostBuilder.InitializeServiceProvider()
at Microsoft.Extensions.Hosting.HostBuilder.Build()
at YAF.Program.Main(String args) in /home/ora/YAFNET/yafsrc/YetAnotherForum.NET/Program.cs:line 53
at YAF.Program.<Main>String args)
Aborted (core dumped)[/code]
Posted by: tha_watcha - Wednesday, 13 December 2023 06:39:37
i checked your build log. I didnt notice you use [b]dotnet publish [/b]in that case the reference assemblies where missing. It its fixed now.
Posted by: ora - Wednesday, 13 December 2023 08:15:45
Weirdly I'm having the exact same issue with PostgreSQL. I haven't tried SQLite again.
Posted by: tha_watcha - Wednesday, 13 December 2023 08:37:35
I tested it on multiple computer
clone the repository
run clean first[b] dotnet clean /p:Configuration=Release YAF.NET-PostgreSQL.sln[/b]
then publish [b]dotnet publish /p:Configuration=Release YAF.NET-PostgreSQL.sln[/b]
and the Npgsql.dll exists in the publish folder
Posted by: ora - Wednesday, 13 December 2023 08:43:38
Am I perhaps checking the wrong publish folder?
yafsrc/YetAnotherForum.NET/bin/Release/net8.0/publish/
Posted by: tha_watcha - Wednesday, 13 December 2023 08:51:38
[quote=ora;73864]Am I perhaps checking the wrong publish folder?
yafsrc/YetAnotherForum.NET/bin/Release/net8.0/publish/[/quote]
That is the correct folder
Posted by: ora - Wednesday, 13 December 2023 08:52:37
I have no idea why I don't have it then. I've even tried deleting the folder and recloning the repo (instead of pulling)
Posted by: tha_watcha - Wednesday, 13 December 2023 08:58:12
Did you try the dotnet clean command? or manually delete the folder yafsrc/YetAnotherForum.NET/obj/ and yafsrc/YetAnotherForum.NET/bin/ before compiling?
Posted by: ora - Wednesday, 13 December 2023 09:00:42
I deleted everything and cloned it exactly from GitHub. Then renamed the test folder, then copied the clean and publish commands directly from your post. I have no idea what's going on! 😓
Posted by: tha_watcha - Wednesday, 13 December 2023 09:15:33
I added the properties to the YAF.Data.PostgreSQL project file. Can you pull the latest commit and try again.
Posted by: ora - Wednesday, 13 December 2023 09:24:04
That did it! It;s running! 🎉
Thanks very much!
Posted by: ora - Wednesday, 13 December 2023 09:37:03
I stand corrected That was enough to get it past first run but upon standing it up I'm seeing the same issue I was originally facing with SQLite:
NoValidDbAccessProviderFoundException: Unable to Locate Provider Named "Microsoft.Data.SqlClient" in Data Access Providers (DLL Not Located in Bin Directory?).
This is particularly odd because I can see Microsoft.Data.SqlClient.dll does exist in the publish folder.
Posted by: tha_watcha - Wednesday, 13 December 2023 09:44:36
Depending on what data provider you are using, you need to modify the appsettings.json where you define the provider and the connection string.
For SQLite it would be under connectionstrings...
[code=markup] "DefaultConnection": "Data Source=databasename.db;Version=3;"[/code]
and under BoardConfiguration
[code=markup]"ConnectionProviderName": "System.Data.SQLite"[/code]
for Postgres it would be...
[code=markup] "DefaultConnection": "Server=localhost;Port=5432;User Id=postgres;Password=XXXX;Database=databasename;"[/code]
and under BoardConfiguration
[code=markup]"ConnectionProviderName": "Npgsql Data Provider"[/code]