New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SqlClient for Windows: Native SNI depends on MSVCR110.dll #15407
Comments
Note that the msvcr110.dll dependency will likely prevent SqlClient from working on Nano server, that would be pretty lame. |
@divega that's correct. We build clrcompression.dll against msvcrt.dll today. Sni.dll needs to do the same. You should be able to control this in your project settings for SNI.dll. /cc @weshaggard |
I looked at the sni.dll implementation and there are usages of _dupenv_s at three locations. Apart from the dependency on the above function, the build properties should be changed to refer the C runtime from the Windows core system runtime. |
Another note: The _dupenv_s () function is used to retrieve the CLUSTER_NETWORK_NAME |
@mikedn As far as the Nano Server is concerned, this bug is not relevant. We need to build Managed SNI based SqlClient for Nano server. Currently the dlls generated for Linux and OSX are managed SNI based where TCP connectivity has been implemented. |
@saurabh500 How would the managed SNI version would be selected on Nano server? As far as I can tell the managed SNI is selected at compile time so it would seem that we need different a SqlClient assembly for Nano, that may be a bit cumbersome. |
@mikedn yes the managed SNI is built at compile time. |
@saurabh500 Sounds good, thanks for the information. |
I have installed Microsoft Visual C++ 2012 Redistributable, but this does not seem to resolve the issue on coreclr-x64-rc1-update1 with Windows Server 2008 R2. @divega |
@juswes did you run this inside IIS ? |
This issue seems to be related with https://github.com/dotnet/corefx/issues/5252 After installing VS C++ 2012 Redistributable still not solve the problem if the application is running inside IIS |
@KKhurin Correct, it only occurs when you run a published version of your web app in IIS on Windows Server 2008 R2. If you use the "web" comment from the command line the app works fine. I now installed everything on a Windows Server 2012 R2 server and then I can publish to IIS and run the web app just fine. So it seems this issue only occurs if you publish it to a Windows 2008 R2 server and run it in IIS. |
Any workarounds at this time? I want to publish a webapp to Azure services, I have no control on what version of Win Server they are using? Thank you! |
This is affecting my project as well. It's strange, because it works when I execute dnx web from command-line, but when I try to press play from Visual Studio, the error occurs when I try using the SqlClient class (while attempting to log into an account within the website). I just reformatted my Windows 7 laptop with a new clean copy of Win 7 Pro + Visual Studio 2015 Community Edition, and this error has only happened on the new install. Before reformatting, the project worked just fine. I'm using rc1-final x64 coreclr. |
A fix was delivered into TFS to remove the dependency of sni.dll on mscvcr110.dll |
I just had this error for the first time, after the latest Windows 10 update was automatically installed. I resolved it by copying msvcr110.dll into c:\windows. I found using process explorer that it wasn't able to find it, presumably the update 'updated' it. |
Is there a fix for this issue? I'm still seeing it in my application deployed on AWS using IIS or by launching the application through the command line using the "web" command. I also confirmed the DLL is where it should be in the inetpub folder. |
This issue was fixed and SqlClient doesn't need |
I'm using Windows 7 on my dev machine and the application runs fine on Visual Studio 2015. When I publish it and deploy the application on my AWS Windows Server 2012 R2 server (IIS), i get this issue. I've also verified that the sni.dll file is in the path shown on the error message. The error i'm getting is: DllNotFoundException: Unable to load DLL 'C:\inetpub[app]\approot\packages\runtime.win7-x64.System.Data.SqlClient.sni\4.0.0-beta-23516\runtimes\win7-x64\native\sni.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E) |
@tsiqueira86 You are using a very outdated package there, pre-RC1 even. If you update to the RTM tools and packages, the problem will go away. There's nothing we can do unless this happens...the fix is in the updated packages. |
Thanks! I'm downloading the new tools and will try when it's done. I'll reply here to confirm if it fixes the issue. |
I am getting this issue after publishing to AZURE and it is driving me mad for two days now: the code which triggers this exception is in StartUp.cs when I try to configure app.UseRequestLocalization. PS: Needless to say that it works perfect on my local machine, even when connecting to the AZURE DB, ` On the context I have an extension method that creates the RequestLocalizationOptions. The exception is the following; Application startup exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'System.Data.SqlClient.TdsParser' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.Data.SqlClient.SNILoadHandle' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'sni.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E) Hosting environment: Production |
@ctonger what does your |
@NickCraver this is what I thought, but not really. ` "dependencies": { "tools": { "frameworks": { "buildOptions": { "runtimes": { "publishOptions": { "scripts": { I initially thought that it may have to do with the fact that I used EF in startup. So I removed any possible instantiation prior to that a request is processed in the MVC Pipelin, and I can confirm that I get the exception as soon as the context is created no matter where. It only happens on AZURE. Locally it works perfectly fine. Even when connecting with the same connectionstring to the AZURE DB. |
So I'm having the same exact issue after publishing to AZURE as well. I made sure that I have the latest and gr3atest and to no avail. This is driving me nuts for 2 days as well. The classic case of, it works on my machine and not prod! :( The runtime is set for "win10-x64": {} |
@ctonger can you open a separate issue for the problem you are facing? |
@saurabh500 Will do in a moment. Thanks! |
Using SqlClient can cause a DllNotFoundException on sni.dll. This has been reported a few times by customers trying to use SqlClient on coreclr-x64/x86 on Windows (see dotnet/aspnetcore#904 for detailed symptoms). One of the possible causes is that you may need the Microsoft Visual C++ 2012 Redistributable installed to get SqlClient to work.
Beta8 has not solved the problem, e.g.
link /dump /imports sni.dll
still shows MSVCR110.dll in the list of dependencies.From an email thread with @ericstj it seems that it should use msvcrt.dll instead.
The text was updated successfully, but these errors were encountered: