I have successfully created a asp.net core mvc application that is hosted on a Ubuntu Linux server. The website runs and works properly.
Today I added Entity Framework to my project. I can post data to my database and retrieve it on my windows machine, so that is working.
When I move my project to my Ubuntu machine, the website works but when I try to access pages that require my database I get this error:
PlatformNotSupportedException: LocalDB is not supported on this Platform.
System.Data.SqlClient.SNI.LocalDB.GetLocalDBConnectionString(string localDbInstance)
Am I missing Entity Framework/SQL_Server packages on my Ubuntu machine or is there another cause?
Take a look at the error message:
PlatformNotSupportedException: LocalDB is not supported on this Platform.
Which means, LocalDB is not supported on Linux.
Also see this issue on github:
As #ErikEJ said, LocalDB is Windows only. On Linux, you can use EF Core with a remote SQL Server (running on Windows), the preview version of https://learn.microsoft.com/en-us/sql/linux/sql-server-linux-overview, or SQL Azure. Alternatively, you can use the Postgres and SQLite providers.
So in summary, you need another database.
you cant use the local DB file from visual studio on Ubuntu its not supported as error say , but you can use the sql server 2017 as DataBase Engine its now supporting linux or any supported DBMS on Ubuntu
you can use this link to install sql server 2017 in linux
Installation guidance
Related
I have 2 applications that connect to legacy SQL Server 2008 servers. These apps are currently running on .NET 3.1 and working fine.
I want to upgrade them to .NET 6, but in doing so, the app fails to connect to the database. I know this is due to this change in .NET 5:
TLS Cipher Suits
When it tries to connect, I get an error:
A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: SSL Provider, error: 31 - Encryption(ssl/tls) handshake failed)
All of the pages I have found on how to fix this require changing the openssl.cnf file, but unfortunately this is not an option for me. These applications are running on containers in Pivotal Cloud Foundry (or I guess it's called VMware Tanzu now) that I have no control over, and our platform team is unable to modify the openssl.cnf file prior to deployment. The containers run Ubuntu version 18.04. Pretty much the only things I have control over are:
The application itself, which is deployed into a folder and run as a non-admin account
Files installed with the app... I can deploy whatever files I want with the application, but they are all installed under the app folder
The command(s) run to start the application
Environment variables (I can set any I need when my app is deployed)
I also have no control over the database - it is SQL Server 2008 with no option to upgrade.
I have tried changing connection string options like TrustServerCertificate and Encrypt, but nothing works there. And I've tried that using both newer and older versions of both Microsoft.Data.SqlClient and System.Data.SqlClient. All failed.
We had a similar issue with an external API we hit, and were able to create a custom HttpMessageHandler that allowed more ciphers, but I see no option for that with a SqlConnection.
Does anyone know how I can upgrade to .NET 6 and still connect to this database without modifying the openssl.cnf file that comes with the OS?
Patch the server to support TLS 1.2. KB3135244 - TLS 1.2 support for Microsoft SQL Server
I have developed a desktop c# application with localdb. While publishing the application, I have selected .net framework and localdb as a prerequisite. The published setup works fine on my system but when I send the complete setup files to any other system it doesn't work.
Here is my connection string
SqlConnection(#"Data Source=(localdb)\mssqllocaldb;AttachDbFilename=|DataDirectory|\StadiumDatabase.mdf;Integrated Security=True")
Here is what I am selecting in prerequisite
The error that I am getting on other systems.
I have gone through so many blogs and articles regarding this and none of the solutions provided is working.
It looks like you have different versions of LocalDb installed on your development machine, and the installation machine. The default instance MSSQLLocalDB used to be named by version in older versions of LocalDb, v11.0 for example. Microsoft changed that to MSSQLLocalDB in a later version of LocalDB.
The fact that you say (localdb)\mssqllocaldb works on your machine, leads me to believe that you are using that newer version. Your screenshot shows that you have selected LocalDB from SQL 2012, which uses the default instance name v11.0. This means you will need a different connection string remotely vs during development. Unfortunately, I don't know of a good way to detect the instance name to adjust the connection string.
Running different versions of LocalDB on your development machine, and installing a different version on the remote computer, will probably cause you a lot of headaches, like this one. I recommend either installing whatever localDb version you are developing against on the remote machine, or installing 2012 on your development machine, so that everyone has the same version.
Based on comments you made, your development machine is running Sql 2016 (db version 852). You either need to install Sql 2012 on your development machine, or install 2016 as the prerequisite.
I have WPF application that is using EF6 with local SQL Server Compact Edition 4.0 database.
I’m using private deployment for SQL Server Compact Edition.
Application works without any errors on 99% of the workstations but I’m encountering a problem on the single one.
When I launch the application I receive MessageBox with below error:
“Underling provider failed on open”.
The error is thrown by the system (as I don’t have any MessageBox in my code) when I try to initialize Entity Framework data context.
I have found that when I run application “as an administrator” the problem doesn’t occur.
Another thing I have noticed that when I run as an administrator on that laptop it takes a almost minute to load.
The only difference between environments that I can find is that on the not working laptop there is SQL Server Express 2012 installed.
Do you think it can have any influence on my application? Could be some DLLs conflict?
*edit
I have installed SQL Server Express 2012 on the different machine and my application is working without problems. So I'm not sure if that's the reason.
Regards,
I have a windows app which has MySQL backend. I have wampserver installed on my machine which bundles a certain version of phpmyadmin along with MySQL version 5.0.51a. But in client machines they have MySQL version 5.1. In short development is on 5.0, while deployment is on 5.1. This is creating a bit of issues for us, since those two versions behave slightly different. So I got a standalone setup of vesion 5.1 and installed on my (development) machine.
Now when I run my app, it needs either wamp services (version 5.0) turned on, or it needs MySQL 5.1 (standalone installation installed in Program Files>MySQL>...) Both ways work.
Question1: Am I right to assume my app is relying on MySQL 5.0 if only wamp service is turned on and on MySQL 5.1 if only original MySQL service is turned on? Yes I suppose.
Question2 (main question): The app works if I have both services turned on aswell. In that case how can I know which MySQL version is my app running on? All I have is a connectionstring which looks like:
MySqlConnection con = new MySqlConnection("SERVER=localhost; DATABASE=wow;
UID=root;PASSWORD=; Min Pool Size = 0;
Max Pool Size=200");
Tool runs on C#.
You can always use SELECT VERSION(). That will answer both of your questions.
I have created an Windows application.
I used
FRONT END : C# (VISUAL STUDIO 2008)
BACK END : MICROSOFT SQL SERVER 2008
.NET FRAMEWORK : 3.5
Now after deployment when I am installing the application in my Clients machine is it necessary to first install .Net Framework, VisualStudio2008 and Sql Server 2008 before installing Application?
And in which module of building my set up file(FileSystem Editor, Registry editor etc..) should I attach the DataBase?
This is my first application of deployment so please help me out with tips and tracks for deployment?
Thanks in advance!!
You customer will not use Visual Studio, so you don't need to install it.
You will need to install SQL Server manually. You cannot have your setup project install it automatically. Just install SQL Server 2008 (SP1 or higher). I believe this will install all or most of .NET 3.5 for you. If not, then when your setup is run, it will install any other parts of .NET that are needed.
BTW, be sure to test the installation steps on a clean system of your own (maybe on Virtual PC) before trying it on your customer's site!
It depends if you want every client to have SqlServer installed locally (usually, on an Enterprise scenario, you have already a server box with Sql Server running, and you just need to deploy your database there).
If having Sql Server running locally is a requirement, you might want to take a look at this thread which will help you: How to install a custom desktop application database to SQL Express?
You should install SQL Server manually before installing your application.
You just need to install you application, you do not need visual studio. If you use a setup project to do this it should detect that it requires the .Net framework and give the user the option of installing it.
You don't have to install the Visual Studio. For running .Net applications, you only require .Net Framework. And for SQL 2008 also .Net required. And for Database, either you have to run SQL Script or you may need to restore the database. Running SQL Script is better I think, you can do it via a Batch file.