Giter Club home page Giter Club logo

Comments (12)

howryu avatar howryu commented on August 29, 2024 1

@tandasima Can you provide me with my detail? Logging? Also what framework are you using? What is the version?

The project is tested on appveyor https://ci.appveyor.com/project/howryu/snowflake-connector-net/branch/master.

from snowflake-connector-net.

tandasima avatar tandasima commented on August 29, 2024

.NET Framework 4.7

My connection string looks like account=companyname.us-east-1;host=snowflakecomputing.com;user=myusername;password=mypassword

I also tried different variations of the connection string.

Here is the exception

System.AggregateException was unhandled
  HResult=-2146233088
  Message=One or more errors occurred.
  Source=Snowflake.Data
  StackTrace:
       at Snowflake.Data.Core.RestRequestImpl.sendRequest(HttpRequestMessage requestMessage, CancellationToken cancellationToken)
       at Snowflake.Data.Core.RestRequestImpl.post(SFRestRequest postRequest)
       at Snowflake.Data.Core.SFSession.open()
       at Snowflake.Data.Client.SnowflakeDbConnection.Open()
       at ConsoleApplication2.Program.Main(String[] args) in C:\Users\mtandasi\Documents\Visual Studio 2015\Projects\ConsoleApplication2\ConsoleApplication2\Program.cs:line 26
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 
       HResult=-2146233088
       Message=An error occurred while sending the request.
       Source=Snowflake.Data
       StackTrace:
            at Snowflake.Data.Core.HttpUtil.RetryHandler.<SendAsync>d__2.MoveNext()
       InnerException: 
            HResult=-2146233079
            Message=The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
            Source=System
            StackTrace:
                 at System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult, TransportContext& context)
                 at System.Net.Http.HttpClientHandler.GetRequestStreamCallback(IAsyncResult ar)
            InnerException: 
                 HResult=-2146233087
                 Message=The remote certificate is invalid according to the validation procedure.
                 Source=System
                 StackTrace:
                      at System.Net.TlsStream.EndWrite(IAsyncResult asyncResult)
                      at System.Net.PooledStream.EndWrite(IAsyncResult asyncResult)
                      at System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar)
                 InnerException: 

Any idea what could be the issue? Looks like others are able to connect.

from snowflake-connector-net.

howryu avatar howryu commented on August 29, 2024

Looks like a certificate issue. Clients failed to establish a TLS connection with server.

Also, it seems that you are trying to connect to us-east deployment, which use newer certificate and only accept tls 1.2 connection.

Have you tried upgrade your windows? What is your OS and version? Because .net connector truly depends on windows secure channel to establish tls connection, it is possible that your windows environment is out of date.

I will also have a try on my side to see if I can connect to us-east deployment. Since all my appveyor is running against us-west.

from snowflake-connector-net.

howryu avatar howryu commented on August 29, 2024

Update: I have tried on my laptop to connect to a us-east-1 deployment and did not have an issue.

Two other options you could try:

  1. Try connecting to Snowflake UI in InternetExplorer (I guess IE might use Windows Schannel as well) to see if you can connect to Snowflake.
  2. Try to get network dump file to understand in which step of TLS handshake failed.
    Here is a tutorial on how to enable network trace
    https://docs.microsoft.com/en-us/dotnet/framework/network-programming/how-to-configure-network-tracing
    (Sample config can be found in https://github.com/snowflakedb/snowflake-connector-net/blob/master/Snowflake.Data.Tests/App.config as well in commented out block)

Here is (part of) sample output I get from network trace when connecting to https://sfcsupportva.snowflakecomputing.com

System.Net Information: 0 : [2376] InitializeSecurityContext(credential = System.Net.SafeFreeCredential_SECURITY, context = 79f46f8:804140, targetName = sfcsupportva.us-east-1.snowflakecomputing.com, inFlags = ReplayDetect, SequenceDetect, Confidentiality, AllocateMemory, InitManualCredValidation)
System.Net Information: 0 : [2376] InitializeSecurityContext(In-Buffers count=2, Out-Buffer length=0, returned code=OK).
System.Net Information: 0 : [2376] Remote certificate: [Version]
  V3

[Subject]
  CN=*.us-east-1.snowflakecomputing.com
  Simple Name: *.us-east-1.snowflakecomputing.com
  DNS Name: *.us-east-1.snowflakecomputing.com

[Issuer]
  CN=Amazon, OU=Server CA 1B, O=Amazon, C=US
  Simple Name: Amazon
  DNS Name: Amazon

[Serial Number]
  0926A5299A3D28245AE6B9D95709CA6D

[Not Before]
  3/30/2017 5:00:00 PM

[Not After]
  4/30/2018 5:00:00 AM

[Thumbprint]
  DBAFD8C20C20C6F6E49D34642CD9EBA0811F0FAD

[Signature Algorithm]
  sha256RSA(1.2.840.113549.1.1.11)

[Public Key]
  Algorithm: RSA
  Length: 2048
  Key Blob: 30 82 01 0a 02 82 01 01 00 9d b3 b7 e1 90 94 72 c1 12 2f a8 a8 e8 15 7e 9b fe 59 9e 6c da da 41 ea 34 cd e5 59 93 49 65 b2 5c 60 1e e7 a1 af 51 e5 e6 fc 57 da 46 45 5d 54 58 11 0b 38 9d d1 bf 0b a5 e5 fd 45 54 02 2e a3 8f cf 66 ab 4b ee b2 44 c9 ff a3 c5 c6 05 65 f2 02 94 ef e7 e7 19 c4 02 10 13 d6 30 6a 37 45 a0 03 c8 10 2d be bd 06 27 31 9e 88 9a 78 ee 0f 8f b8 68 15 81 b5 0d b4 d5 9c 5b cd 9c ea b1 95 2c 79 bc 8d b2 d8 45 bc b....
System.Net Information: 0 : [2376] SecureChannel#48209832 - Remote certificate was verified as valid by the user.
System.Net Information: 0 : [2376] EndProcessAuthentication(Protocol=Tls12, Cipher=Aes128 128 bit strength, Hash=Sha256 0 bit strength, Key Exchange=44550 256 bit strength).

from snowflake-connector-net.

howryu avatar howryu commented on August 29, 2024

@tandasima Did you figure out the issue? If not, can you try latest Snowflake.Data 0.3.0, which support .net core 2.0, which might resolve your issue.

from snowflake-connector-net.

tandasima avatar tandasima commented on August 29, 2024

@howryu Thanks for the update. Will try the latest 0.3.0 and update you.

Cheers!

from snowflake-connector-net.

andrewabril avatar andrewabril commented on August 29, 2024

Has anyone resolved this issue? I am using the NuGet package v0.3.0 and running on LinqPad 5, but still receiving the following error:

The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.

Thanks!

from snowflake-connector-net.

howryu avatar howryu commented on August 29, 2024

@andrewabril This could be because your windows is out of date. Are you in latest windows? We rely on winssl (schannel) to establish tls connection with server. Have you tried enable network logs? Example is here https://github.com/snowflakedb/snowflake-connector-net/blob/master/Snowflake.Data.Tests/App.config

from snowflake-connector-net.

howryu avatar howryu commented on August 29, 2024

Closed since no response.

from snowflake-connector-net.

churivibhav avatar churivibhav commented on August 29, 2024

Hey @howryu ,
I see the same issue on Windows 10 Pro v 1703, which supports TLS 1.2.
Which Windows version do you recommend to use this driver?

from snowflake-connector-net.

howryu avatar howryu commented on August 29, 2024

@churivibhav Unfortunately, I have not tested every windows machine. Can you share the network log with me?

from snowflake-connector-net.

kechenck avatar kechenck commented on August 29, 2024

I am having the same issue.

I tried to connect from a webapp (I tried both asp.net 4.6, and core 2.1), i got "Remote certificate was verified as invalid by the user". I tried the test project, that project could pass the connection (I only test connections).

I could login from IE, or chrome. I couldn't follow the instruction from the document ->Diagnosing Common Connectivity Issues. I am on Window 10. Out IT patches regularly.

I have System.Net.Trace.log here, I can capture wireshark if needed.

System.Net.Sockets Verbose: 0 : [11940] Exiting Socket#22597652::EndReceive() -> Int32#40
ProcessId=10744
DateTime=2018-10-22T00:39:29.6796940Z
System.Net Information: 0 : [11940] InitializeSecurityContext(credential = System.Net.SafeFreeCredential_SECURITY, context = cb37030:cb53bb8, targetName = east-us-2.azure.snowflakecomputing.com, inFlags = ReplayDetect, SequenceDetect, Confidentiality, AllocateMemory, InitManualCredValidation)
ProcessId=10744
DateTime=2018-10-22T00:39:29.6977428Z
System.Net Information: 0 : [11940] InitializeSecurityContext(In-Buffers count=2, Out-Buffer length=51, returned code=OK).
ProcessId=10744
DateTime=2018-10-22T00:39:29.7057645Z
System.Net Information: 0 : [11940] Remote certificate: [Version]
V3

[Subject]
CN=*.snowflakecomputing.com, OU=Secure Link SSL Wildcard, OU=snowflake computing, O=Snowflake Computing, L=San Mateo, S=CA, PostalCode=94401, C=US
Simple Name: *.snowflakecomputing.com
DNS Name: snowflakecomputing.com

[Issuer]
CN=Network Solutions OV Server CA 2, O=Network Solutions L.L.C., L=Herndon, S=VA, C=US
Simple Name: Network Solutions OV Server CA 2
DNS Name: Network Solutions OV Server CA 2

[Serial Number]
290714BCB7E17B569CE72A1C0783C4D1

[Not Before]
2016-04-04 8:00:00 PM

[Not After]
2019-04-13 7:59:59 PM

[Thumbprint]
B64B85AA164DC0FE956465D42475EA9BED2A4C52

[Signature Algorithm]
sha256RSA(1.2.840.113549.1.1.11)

[Public Key]
Algorithm: RSA
Length: 4096
Key Blob: 30 82 02 0a 02 82 02 01 00 e9 d5 8b fa 42 fa 10 5c bd 8f 29 fb 65 bf 76 c8 86 d4 ce d6 39 5a f7 de bf b7 5d b6 e1 d6 1b 96 4e e9 f0 aa 2d 18 96 a5 fa 8f ef 85 d9 b3 f8 68 e8 b3 80 2e a0 b0 f9 1d 60 57 1f 65 b4 7c 5e a4 1b 18 7e 00 64 d0 22 77 37 75....
ProcessId=10744
DateTime=2018-10-22T00:39:29.7087713Z
System.Net Information: 0 : [11940] SecureChannel#4386714 - Remote certificate has errors:
ProcessId=10744
DateTime=2018-10-22T00:39:29.7107775Z
System.Net Information: 0 : [11940] SecureChannel#4386714 - Certificate name mismatch.
ProcessId=10744
DateTime=2018-10-22T00:39:29.7117797Z
System.Net Information: 0 : [11940] SecureChannel#4386714 - Remote certificate was verified as invalid by the user.
ProcessId=10744
DateTime=2018-10-22T00:39:29.7127824Z
System.Net.Sockets Verbose: 0 : [11940] Entering Socket#22597652::Dispose()
ProcessId=10744
DateTime=2018-10-22T00:39:29.7508845Z
System.Net Error: 0 : [11940] Exception in HttpWebRequest#41348378:: - The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel..
ProcessId=10744
DateTime=2018-10-22T00:39:29.7518863Z
System.Net Verbose: 0 : [11940] Entering HttpWebRequest#41348378::EndGetResponse()
ProcessId=10744
DateTime=2018-10-22T00:39:29.7528890Z
System.Net Error: 0 : [11940] Exception in HttpWebRequest#41348378::EndGetResponse - The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel..
ProcessId=10744
DateTime=2018-10-22T00:39:29.7538920Z
System.Net Verbose: 0 : [1428] Entering HttpWebRequest#16991442::Abort()
ProcessId=10744
DateTime=2018-10-22T00:39:43.3931521Z
System.Net Error: 0 : [1428] Exception in HttpWebRequest#16991442:: - The request was aborted: The request was canceled..
ProcessId=10744
DateTime=2018-10-22T00:39:43.4031743Z
System.Net Verbose: 0 : [1428] Exiting HttpWebRequest#16991442::Abort()
ProcessId=10744
DateTime=2018-10-22T00:39:43.4142032Z
System.Net Verbose: 0 : [1428] Entering HttpWebRequest#41348378::Abort()
ProcessId=10744
DateTime=2018-10-22T00:39:44.8901285Z
System.Net Error: 0 : [1428] Exception in HttpWebRequest#41348378:: - The request was aborted: The request was canceled..
ProcessId=10744
DateTime=2018-10-22T00:39:44.9011558Z
System.Net Verbose: 0 : [1428] Exiting HttpWebRequest#41348378::Abort()
ProcessId=10744
DateTime=2018-10-22T00:39:44.9091775Z

from snowflake-connector-net.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.