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
Related
I wrote a small app to learn more about SQL and experiment with Entity Framework. On first execution, my app creates the database locally, and after that opens the existing database. So far, so good - it works pretty well on my laptop, which has SQL Server 2017 installed.
I tried copying the assemblies to my desktop machine and that also worked as expected, though SQL Server was not installed.
But when I tried copying the assemblies to another laptop, the app would not run. The exception I saw was:
A network-related or instance-specific error occurred while
establishing a connection to SQL Server. The Server was not found or
was not accessible. Verify that the instance name is correct and that
SQL Server is configured to allow remote connections. (provider: SQL
Network Interfaces, error: 52 - Unable to locate a local Database
Runtime Installation. Verify SQL Server Express is properly installed
and that the Local Database Runtime feature is enabled.)
All machines are Windows 10. (Is it significant that the desktop machine has Visual Studio 2019 installed?)
I can't seem to find a post here which speaks to my problem. (I'm probably not phrasing my query well...)
Anyway, I don't want other users to be required to install SQL Server (Express, or otherwise). What do I need to include in my installation?
Can it be done more-or-less automatically by using ClickOnce deployment (a.k.a. Publishing Wizard)? Or do I need to build an .msi with Wix code?
Is SQLite a better option for this? Users of my app will not be sharing databases; each will have their own.
I have seen mention of SQL Server Compact Edition in this post: ASP.NET MVC - Switching from SQL Server Express to Compact Edition - Connection Issue, but when I tried to run this down, it seemed like this is no longer available from Microsoft. And I believe I'm already using SQL Server Express (looks like this is confirmed by the error message, above)...
At present I have worked around this problem by using ClickOnce deployment. In the near term, I would like to change the installation to include the dependencies (.NET & SQL runtimes) in the setup package, rather than downloading them at install-time.
But I wonder if SQLite would be a better long-term solution... One thing I have appreciated about SQLServer is that I can use SQLServer Management Studio to get at the database apart from the app, so I can validate what the app has done. I also think this is a good thing for users, as they will always have a second option for getting their data, if something goes wrong with the app.
Does SQLite provide any tool similar to SQLServer Management Studio for accessing the database?
SQLite is a better option as it is an embedded database. This means that it is a part of your application and doesn't require additional setup. It works well for storing per-user data that is not shared.
https://www.sqlite.org/whentouse.html
SQLite only requires its assemblies for deployment.
SQLite deployment for .net application
I am unable to connect to SQL Server 2008 R2 from my PHP v7.1.7 website running under IIS.
Basic PHP pages display ok - but nothing to do with sql server works.
So the basic IIS site and PHP use are ok.
I have downloaded the SQL Server drivers drivers and configured them in the php.ini file
I am aware that the php 7.1 drivers are different to other php versions.
extensions directory (ext) has following DLLs added:
php_pdo_sqlsrv_71_nts.dll
php_sqlsrv_71_nts.dll
"C:\Program Files\PHP\v7.1\php.ini" has following extensions added:
[ExtensionList]
extension=php_sqlsrv_7_nts.dll
extension=php_pdo_sqlsrv_7_nts.dll
The PHP manager in IIS shows these extensions enabled.
On debugging I notice there is a basic problem loading these drivers in the error file
PHP71x64_errors.log
i.e.
[13-Mar-2018 00:51:27 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files\PHP\v7.1\ext\php_sqlsrv_7_nts.dll' - The specified module could not be found.
in Unknown on line 0
[13-Mar-2018 00:51:27 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files\PHP\v7.1\ext\php_pdo_sqlsrv_7_nts.dll' - The specified module could not be found.
in Unknown on line 0
The files do exist at those locations and I granted everyone full access - including IUSR the default user of the iis application pool used for the website.
Now the chat sites are full of this problem - no one seems to have a definitive answer. Most blogs point to yet another set of sql server drivers to try that do not work.
My questions are:
1) Should the thread safe (ts) or non thread safe (nts) version of the SQL Server drivers drivers be used with IIS on win 10?
2) I assume as win 10 is 64bit - the 64 bit version of the drivers should be used instead of the x86 ones - can someone confirm?
3) Can anyone point me to a definitive SQL Server 2008 R2 driver download that is GUARANTEED to work with my win 10 and IIS v10.0.16299.15 install?
Note: I have already downloaded the wp-db-abstraction must use PHP plugin for SQL Server and installed into the mu-plugins directory.
The problem was the ODBC driver php_odbc.dll extension was disabled as viewed in PHP Manager on the website. Enabled it and everything worked fine.
Note: I actually wanted to use SQL Server instead of MySQL for wordpress but i see i'd have to use the projectnami wordpress download for that. (projectnami.org)
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
I have made a desktop app Setup that connects with remote Oracle 10g Database. When I install Setup on remote machine and run my application then I get following error:
system.data.oracleclient requires oracle client software version 8.1.7 or greater
It works well on my Development machine.
It is a security issue, so to fix it simply do the following:
Go to the Oracle Client folder.
Right Click on the folder.
On security Tab, Add "Authenticated Users" and give this account Read & Execute permission.
Apply this security for all folders, Subfolders and Files (IMPORTANT).
Don't Forget to REBOOT your Machine; if you forgot to do this you will still face the same problem unless you restart your machine.
http://blogs.msdn.com/b/fabdulwahab/archive/2011/11/13/system-data-oracleclient-requires-oracle-client-software-version-8-1-7-or-greater.aspx
The error message is pretty self-explanatory: your application needs the Oracle Client installed on the machine it's running on. Your development PC already has it. Make sure your target PC has it, too.
Edit: The System.Data.OracleClient namespace is deprecated. Make sure you use the driver native to your database system, that would be ODP.NET from Oracle.
Install Nuget for Oracle.ManagedDataAccess
Make sure you are using header for Oracle:
using Oracle.ManagedDataAccess.Client;
This Worked for me.
On your remote machine, System.Data.OracleClient need access to some of the oracle dll which are not part of .Net. Solutions:
Install Oracle Client , and add bin location to Path environment varaible of windows
OR
Copy
oraociicus10.dll (Basic-Lite version) or aociei10.dll (Basic version),
oci.dll, orannzsbb10.dll and oraocci10.dll from oracle client installable folder to bin folder of application so that application is able to find required dll
On your local machine most probably path to Oracle Client is already added in Path environment variable to there required dll are available to application but not on remote machine
If you have to use the older client, here is my experience.
We are running a 32bit server so the development machines run the 32bit client. We run the 11.1 install, 11.2 gets the error. Once you have installed the 11.2 version you have to manually delete the files Oracle.Web.dll and System.Data.OracleClient.dll from the %windir%\Microsoft.NET\Framework\v2.0.50727, reinstall 11.1, then register the dlls with gacutil.exe.
This fixed the issue with my systems.
Go to C:\app\insolution\product\11.2.0\client_1\BIN and find oci.dll. Right click on it -->Properties -->Under Security tab, click on Edit -->Then Click on Add Button --> Here add two new users with names IUSR and IIS_IUSRS and give them full controls. That's it.
After installation of Oracle Client 11.02.04, reboot the server and make sure USERS(Local Computer) is added with Full Control on Root folder for eg WWW
Tested, it worked.
This posting is about mostly desktops and this oracle message. I want to talk about server class machines running a dtexec that are throwing this error message. In one case it meant that an installed oracle client instance on a server machine was no longer there, and it had been there for a long time. On the client side we found recently 1/2023 that certain versions of the oracle client 32 bit don't run on a laptop with AMD chips. Downgrading to a lower version of the oracle client 19.x fixed the problem.
My company recently using tivoli workload scheduler (TWS) to remote trigger jobs from an z/OS to window server. we have tested the tivoli can trigger the mssql services successfully.
The problem now is we have a .NET CL program that we used daily to extract some data in AS400 to mssql server, it was worked perfectly before when using windows scheduler and trigger daily in specific time frame. now we trying to centralize the scheduler so the TWS remotely trigger a prepared batch file (it will trigger the CL program).
but the execution of the CL program show following error while trying to connect to AS400 DB.
The .Net Framework Data Providers require Microsoft Data Access Components(MDAC). Please install Microsoft Data Access Components(MDAC) version 2.6 or later.
EDITED:
in normal scenario, we were assumed the program can trigger successfully, it should be just like using windows scheduler, set a schedule and execute it. the only differences is the scheduler is not windows scheduler for now, but switch to TWS and trigger the CL program remotely. but the execute show the above error during executing the CL program. we have no idea why this error comes up.
we tried to rerun the CL program and schedule it in windows scheduler, works fine. but schedule on TWS remotely, error.
For the testing and observation we have done so far:
Our server is Windows server 2008 SP2 x64, I have made some researches the MDAC used in old version windows while server 2008 should deliver with a newer version of MDAC (WDAC 6.0) and it cannot be reinstall so i assume the MDAC/WDAC must be install correctly.
the CL program was compiled with .NET 2.0/ 3.0 / 3.5, and tested all of them produce the same error.
they error logs were able to produce to sql server DB, so I assume the connection driver using in CL program have no problem. but it might be caused by IBMDA400 driver.
TWS use the admin account in our server to trigger the batch files, a TWS client (listener) is installed in our server for trigger programs in our server, but we dont know how they connect to our server (SSH? telnet?) and they seems donot actually login to our server for remote trigger(trigger our job in silent mode).
we are desperate in seeking any solutions, if anyone could provide any clues or thoughts, it would be very helpful and provide a big help to the people with the same problem in the future.
Thank you very much!.
For those searching, I recently got this error in a web app despite MDAC 2.8 SP1 being already installed on the 2008 box. We re-installed MDAC and it did not seem to fix. Stopping and starting the app pool for the affected web app fixed the problem. It's not 100% clear if the re-install was necessary, or if windows updates or something required an iisreset that didn't happen.
The reason for this error is that the application pool is trying to read a registry key from the HKey_Current_User hive which isn't always loaded.
The solution is as follow:
Open IIS management console
Click on "Application Pools"
Right-click the pool for your web site and select "Advanced Settings"
Change the setting "Load User Profile" to True
I can only give you some avenues to investigate.
You may want to try using the IBM DB2 iSeries ADO.NET Data provider instead of using the IBMDA400 OLE DB provider. My team had a similar experience when we went through a re-platforming project to a newer Windows Server that was x64. For some reason we had very strange results trying to use the older OLE DB providers on our .NET Windows Services. We later found out it was due to our server being 64bit.
I am suspecting you are having an issue with the IBMDA400 is a 32bit driver. Check if you are compiling your .NET CL program as 64bit. You could try to compile your program as a 32 bit application and enabling Wow64 on your server.
Hope one of these leads you to a solution!