Can't complete installation on Debian "TdsParser' threw an exception"

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
4 года назад
I followed the steps mentioned in the user guide.

It runs but it throws some errors after starting the application.
Dec 04 23:12:42 Medusa dotnet[31881]: Nop.Web Error: 0 :
Dec 04 23:12:42 Medusa dotnet[31881]: System.BadImageFormatException: Could not load file or assembly '/var/www/nopCommerce420/hostfxr.dll'. The module was expected to contain an assembly manifest.
                                      File name: '/var/www/nopCommerce420/hostfxr.dll'
                                         at System.Reflection.AssemblyName.nGetFileInformation(String s)
                                         at Nop.Core.Infrastructure.AppDomainTypeFinder.LoadMatchingAssemblies(String directoryPath) in C:\andrei\nopcommerce\sources\src\Libraries\Nop.Core\Infrastructure\AppDomainTypeFinder.cs:line 130
Dec 04 23:12:42 Medusa dotnet[31881]: Nop.Web Error: 0 :
Dec 04 23:12:42 Medusa dotnet[31881]: System.BadImageFormatException: Could not load file or assembly '/var/www/nopCommerce420/hostpolicy.dll'. The module was expected to contain an assembly manifest.
                                      File name: '/var/www/nopCommerce420/hostpolicy.dll'
                                         at System.Reflection.AssemblyName.nGetFileInformation(String s)
                                         at Nop.Core.Infrastructure.AppDomainTypeFinder.LoadMatchingAssemblies(String directoryPath) in C:\andrei\nopcommerce\sources\src\Libraries\Nop.Core\Infrastructure\AppDomainTypeFinder.cs:line 130
Dec 04 23:12:42 Medusa dotnet[31881]: Nop.Web Error: 0 :
Dec 04 23:12:42 Medusa dotnet[31881]: System.BadImageFormatException: Could not load file or assembly '/var/www/nopCommerce420/sni.dll'. The module was expected to contain an assembly manifest.
                                      File name: '/var/www/nopCommerce420/sni.dll'
                                         at System.Reflection.AssemblyName.nGetFileInformation(String s)
                                         at Nop.Core.Infrastructure.AppDomainTypeFinder.LoadMatchingAssemblies(String directoryPath) in C:\andrei\nopcommerce\sources\src\Libraries\Nop.Core\Infrastructure\AppDomainTypeFinder.cs:line 130
Dec 04 23:12:42 Medusa dotnet[31881]: Nop.Web Error: 0 :
Dec 04 23:12:42 Medusa dotnet[31881]: System.BadImageFormatException: Could not load file or assembly '/var/www/nopCommerce420/aspnetcorev2_inprocess.dll'. The module was expected to contain an assembly manifest.
                                      File name: '/var/www/nopCommerce420/aspnetcorev2_inprocess.dll'
                                         at System.Reflection.AssemblyName.nGetFileInformation(String s)
                                         at Nop.Core.Infrastructure.AppDomainTypeFinder.LoadMatchingAssemblies(String directoryPath) in C:\andrei\nopcommerce\sources\src\Libraries\Nop.Core\Infrastructure\AppDomainTypeFinder.cs:line 130
Dec 04 23:12:43 Medusa dotnet[31881]: Nop.Web Error: 0 :
Dec 04 23:12:43 Medusa dotnet[31881]: System.BadImageFormatException: Could not load file or assembly '/var/www/nopCommerce420/hostfxr.dll'. The module was expected to contain an assembly manifest.
                                      File name: '/var/www/nopCommerce420/hostfxr.dll'
                                         at System.Reflection.AssemblyName.nGetFileInformation(String s)
                                         at Nop.Core.Infrastructure.AppDomainTypeFinder.LoadMatchingAssemblies(String directoryPath) in C:\andrei\nopcommerce\sources\src\Libraries\Nop.Core\Infrastructure\AppDomainTypeFinder.cs:line 130
Dec 04 23:12:43 Medusa dotnet[31881]: Nop.Web Error: 0 :
Dec 04 23:12:43 Medusa dotnet[31881]: System.BadImageFormatException: Could not load file or assembly '/var/www/nopCommerce420/hostpolicy.dll'. The module was expected to contain an assembly manifest.
                                      File name: '/var/www/nopCommerce420/hostpolicy.dll'
                                         at System.Reflection.AssemblyName.nGetFileInformation(String s)
                                         at Nop.Core.Infrastructure.AppDomainTypeFinder.LoadMatchingAssemblies(String directoryPath) in C:\andrei\nopcommerce\sources\src\Libraries\Nop.Core\Infrastructure\AppDomainTypeFinder.cs:line 130
Dec 04 23:12:43 Medusa dotnet[31881]: Nop.Web Error: 0 :
Dec 04 23:12:43 Medusa dotnet[31881]: System.BadImageFormatException: Could not load file or assembly '/var/www/nopCommerce420/sni.dll'. The module was expected to contain an assembly manifest.
                                      File name: '/var/www/nopCommerce420/sni.dll'
                                         at System.Reflection.AssemblyName.nGetFileInformation(String s)
                                         at Nop.Core.Infrastructure.AppDomainTypeFinder.LoadMatchingAssemblies(String directoryPath) in C:\andrei\nopcommerce\sources\src\Libraries\Nop.Core\Infrastructure\AppDomainTypeFinder.cs:line 130
Dec 04 23:12:43 Medusa dotnet[31881]: Nop.Web Error: 0 :
Dec 04 23:12:43 Medusa dotnet[31881]: System.BadImageFormatException: Could not load file or assembly '/var/www/nopCommerce420/aspnetcorev2_inprocess.dll'. The module was expected to contain an assembly manifest.
                                      File name: '/var/www/nopCommerce420/aspnetcorev2_inprocess.dll'
                                         at System.Reflection.AssemblyName.nGetFileInformation(String s)
                                         at Nop.Core.Infrastructure.AppDomainTypeFinder.LoadMatchingAssemblies(String directoryPath) in C:\andrei\nopcommerce\sources\src\Libraries\Nop.Core\Infrastructure\AppDomainTypeFinder.cs:line 130


Then I fill the fields as follows:


But it throws this error:
    Setup failed: An error occurred while creating the database: The type initializer for 'System.Data.SqlClient.TdsParser' threw an exception.


Can someone please help me?
4 года назад
I am having the same problem on Ubuntu 16.04.6 LTS.
If I create the database using SSMS and uncheck 'Create database if it doesn't exist' then I get the error "Setup failed: Database does not exist or you don't have permissions to connect to it".
4 года назад
Vukko wrote:
...or you don't have permissions to connect to it".


verify that you can connect to it and create a sample table (using a tool like SSMS).
From Linux, can you use isql or similar to test connection?
4 года назад
New York wrote:
verify that you can connect to it and create a sample table (using a tool like SSMS).
From Linux, can you use isql or similar to test connection?


Thanks for your reply. Yes, I can connect to it using the sqlcmd command line tool and create a database. I can also do same using SSMS.
The problem doesn't see to be with SQL Server but rather .NET SqlClient. I have just spun up a brand new VM with Ubuntu 18.04.3 LTS and the result is identical.
4 года назад
It doesn't seem to matter what I enter for SQL credentials, it doesn't seem to be making connection to the SQL Server.
4 года назад
Hi I have exactly the same issue.

I have followed the tutorial here:
https://docs.nopcommerce.com/user-guide/installing/linux.html

Brand new installation of 4.2 on Ubuntu 18.04 with mssql-server=14.0.3192.2-2 (had to downgrade due to this issue)

If I use SA credentials in the connection string and tick "Create database if it doesn't exist" I get:
"Setup failed: An error occurred while creating the database: The type initializer for 'System.Data.SqlClient.TdsParser' threw an exception."

If I won't tick "Create database if it doesn't exist" I get:
"Setup failed: Database does not exist or you don't have permissions to connect to it"

I can definitely connect to the sql service on the server remotely using SSMS and the same credentials. I can also run queries/create tables using sqlcmd tools locally on the machine.

The connection string:
Server=tcp:localhost,1433;Initial Catalog=nopc_dev;Persist Security Info=False;User ID=sa;Password=mypass;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;

When I run sudo systemctl status nopCommerce420.service I get this:
nopCommerce420.service - Example nopCommerce app running on XUbuntu
   Loaded: loaded (/etc/systemd/system/nopCommerce420.service; disabled; vendor preset: enabled)
   Active: active (running) since Sat 2020-01-04 09:46:19 UTC; 1min 24s ago
Main PID: 6065 (dotnet)
    Tasks: 15 (limit: 4070)
   CGroup: /system.slice/nopCommerce420.service
           └─6065 /usr/bin/dotnet /var/www/nopCommerce420/Nop.Web.dll

Jan 04 09:46:21 p-nopc-ss-lnx-vm dotnet[6065]: Nop.Web Error: 0 :
Jan 04 09:46:21 p-nopc-ss-lnx-vm dotnet[6065]: System.BadImageFormatException: Could not load file or assembly '/var/www/nopCommerce420/aspnetcorev2_inprocess.dll'. The module was expected to contain an assembly manifest.
                                               File name: '/var/www/nopCommerce420/aspnetcorev2_inprocess.dll'
                                                  at System.Reflection.AssemblyName.nGetFileInformation(String s)
                                                  at Nop.Core.Infrastructure.AppDomainTypeFinder.LoadMatchingAssemblies(String directoryPath) in C:\andrei\nopcommerce\sources\src\Libraries\Nop.Core\Infrastructure\AppDomainTypeFinder.cs:line 130
Jan 04 09:46:21 p-nopc-ss-lnx-vm dotnet[6065]: Nop.Web Error: 0 :
Jan 04 09:46:21 p-nopc-ss-lnx-vm dotnet[6065]: System.BadImageFormatException: Could not load file or assembly '/var/www/nopCommerce420/hostfxr.dll'. The module was expected to contain an assembly manifest.
                                               File name: '/var/www/nopCommerce420/hostfxr.dll'
                                                  at System.Reflection.AssemblyName.nGetFileInformation(String s)
                                                  at Nop.Core.Infrastructure.AppDomainTypeFinder.LoadMatchingAssemblies(String directoryPath) in C:\andrei\nopcommerce\sources\src\Libraries\Nop.Core\Infrastructure\AppDomainTypeFinder.cs:line 130
Jan 04 09:46:21 p-nopc-ss-lnx-vm dotnet[6065]: Nop.Web Error: 0 :
Jan 04 09:46:21 p-nopc-ss-lnx-vm dotnet[6065]: System.BadImageFormatException: Could not load file or assembly '/var/www/nopCommerce420/sni.dll'. The module was expected to contain an assembly manifest.
                                               File name: '/var/www/nopCommerce420/sni.dll'
                                                  at System.Reflection.AssemblyName.nGetFileInformation(String s)
                                                  at Nop.Core.Infrastructure.AppDomainTypeFinder.LoadMatchingAssemblies(String directoryPath) in C:\andrei\nopcommerce\sources\src\Libraries\Nop.Core\Infrastructure\AppDomainTypeFinder.cs:line 130
Jan 04 09:46:25 p-nopc-ss-lnx-vm nopCommerce420-example[6065]: Hosting environment: Production
Jan 04 09:46:25 p-nopc-ss-lnx-vm nopCommerce420-example[6065]: Content root path: /var/www/nopCommerce420
Jan 04 09:46:25 p-nopc-ss-lnx-vm nopCommerce420-example[6065]: Now listening on: http://localhost:5000
Jan 04 09:46:25 p-nopc-ss-lnx-vm nopCommerce420-example[6065]: Application started. Press Ctrl+C to shut down.

Could anyone please advise how to fix this?
4 года назад
Ok, it seems there is some issue with the precompiled package included the tutorial
https://github.com/nopSolutions/nopCommerce/releases/download/release-4.20/nopCommerce_4.20_NoSource_FrameworkDependent.rar

When I downloaded the source code nopCommerce_4.20_Source.rar, built it and published onto the vm the nopCommerce 4.20 installed OK!
4 года назад
Wow, this is great news. How did you build from source, using VS on a Windows machine?
4 года назад
Yes, I built it using Visual Studio 2019.
- Nop.Web -> Publish -> Folder
- rar the contents of the folder and upload somewhere accessible from the Ubuntu
- and then just used the same 'sudo wget' command to download it and unrar on the Ubuntu

Just to let you know that during installation I got '504 Gateway Time-Out' error but it's probably due to the short nginx timeout configuration - the nopCommerce seems to installed fine.
4 года назад
Thanks very much for this info! I will give it a bash and post the results.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.