Unable to load DLL 'Microsoft.Data.SqlClient.SNI.x64.dll'

Ocelot013 1 Reputation point
2021-06-14T07:46:55.157+00:00

I have two published environment, Staging and one for live. my published project works in test env. without any issue, but as soon as I deploy it on live env.
I also should mention that Microsoft.Data.SqlClient.SNI.x64.dll exists in \bin after deployment.

I get the following error:

ERROR 2021-06-08 16:45:34,415 455867ms ysomeController MoveNext           - System.TypeInitializationException: The type initializer for 'Microsoft.Data.SqlClient.TdsParser' threw an exception. ---> System.TypeInitializationException: The type initializer for 'Microsoft.Data.SqlClient.SNILoadHandle' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'Microsoft.Data.SqlClient.SNI.x64.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
   at Microsoft.Data.SqlClient.SNINativeManagedWrapperX64.SNIInitialize(IntPtr pmo)
   at Microsoft.Data.SqlClient.SNILoadHandle..ctor() in H:...\Microsoft\Data\SqlClient\TdsParserSafeHandles.cs:line 19
   at Microsoft.Data.SqlClient.SNILoadHandle..cctor() in H:...\Microsoft\Data\SqlClient\TdsParserSafeHandles.cs:line 17
   --- End of inner exception stack trace ---
   at Microsoft.Data.SqlClient.TdsParser..cctor() in H:...\Microsoft\Data\SqlClient\TdsParser.cs:line 177
   --- End of inner exception stack trace ---
   at Microsoft.Data.SqlClient.TdsParser..ctor(Boolean MARS, Boolean fAsynchronous) in H:...\Microsoft\Data\SqlClient\TdsParser.cs:line 38
   at Microsoft.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) in H:...\Microsoft\Data\SqlClient\SqlInternalConnectionTds.cs:line 1831
   at Microsoft.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance) in 
.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,398 questions
{count} votes

17 answers

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  3. Unexpectedend 0 Reputation points
    2023-07-22T13:27:30.24+00:00

    Welcome to UnexpectedEndOfFile.com the ultimate hub for programming error solutions and all things related to technology, programming, and computing! Whether you're an experienced developer seeking bug fixes or a tech enthusiast eager to delve into the digital world, you've come to the right place. Our platform is a treasure trove of insightful articles, tutorials, and the latest updates on software, hardware, coding languages, and much more.Become part of our vibrant community of tech-savvy individuals, where we collaborate, troubleshoot, and exchange knowledge to conquer coding challenges together. Let's embark on a fascinating journey into the realm of bits and bytes. Get ready to be inspired, learn, and stay ahead in the ever-evolving world of technology right here at UnexpectedEndOfFile.com. Happy browsing!

    0 comments No comments

  4. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  5. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more