Need help in connecting the Azure Postgres Database. No matter what I do, it just won't connect. The same piece of code works fine on my local database, database on VM, but not on Azure Postgres. My firewall setting seems ok because PgAdmin also works fine. User Id and Password are perfectly ok. Tried to turn off the SSL setting, but ALL documentations on Azure / Microsoft are out-dated, There is NO connection security. Nothing is working :(
My connection string looks like this:
<connectionStrings>
<add name="DefaultConnectionString" connectionString="server=somedatabase.postgres.database.azure.com;Port=5432;User Id={user id};Password={password};database={databasename};sslmode=require;" providerName="Npgsql" />
</connectionStrings>
ERROR Look like this:
[Win32Exception (0x80004005): The function requested is not supported]
[AuthenticationException: A call to SSPI failed, see inner exception.]
System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, Exception exception) +1814964
System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest) +121
System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest) +51
System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest) +52
System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest) +207
System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest) +139
System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest) +297
System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest) +51
System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest) +166
System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult) +573
System.Net.Security.SslStream.AuthenticateAsClient(String targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, Boolean checkCertificateRevocation) +50
Npgsql.NpgsqlClosedState.Open(NpgsqlConnector context, Int32 timeout) +1853
[NpgsqlException (0x80004005): Failed to establish a connection to 'somedatabase.postgres.database.azure.com'.]
Npgsql.NpgsqlClosedState.Open(NpgsqlConnector context, Int32 timeout) +2026
Npgsql.NpgsqlConnector.Open() +91
Npgsql.NpgsqlConnection.Open() +328
Npgsql.NpgsqlServices.UsingPostgresDBConnection(NpgsqlConnection connection, Action1 action) +137 Npgsql.NpgsqlServices.GetDbProviderManifestToken(DbConnection connection) +99 System.Data.Entity.Core.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection) +88 [ProviderIncompatibleException: The provider did not return a ProviderManifestToken string.] System.Data.Entity.Core.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection) +272 System.Data.Entity.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices providerServices, DbConnection connection) +27 [ProviderIncompatibleException: An error occurred accessing the database. This usually means that the connection to the database failed. Check that the connection string is correct and that the appropriate DbContext constructor is being used to specify it or find it in the application's config file. See http://go.microsoft.com/fwlink/?LinkId=386386 for information on DbContext and connections. See the inner exception for details of the failure.] System.Data.Entity.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices providerServices, DbConnection connection) +89 System.Data.Entity.Infrastructure.<>c__DisplayClass1_0.<ResolveManifestToken>b__0(Tuple
3 k) +32
System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func
2 valueFactory) +73
System.Data.Entity.Infrastructure.DefaultManifestTokenResolver.ResolveManifestToken(DbConnection connection) +251
System.Data.Entity.Utilities.DbConnectionExtensions.GetProviderInfo(DbConnection connection, DbProviderManifest& providerManifest) +56
System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection) +43
System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext) +159
System.Data.Entity.Internal.RetryLazy2.GetValue(TInput input) +123 System.Data.Entity.Internal.LazyInternalContext.InitializeContext() +676 System.Data.Entity.Internal.InternalContext.Initialize() +20 System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +16 System.Data.Entity.Internal.Linq.InternalSet
1.Initialize() +53
System.Data.Entity.Internal.Linq.InternalSet1.get_InternalContext() +15 System.Data.Entity.Infrastructure.DbQuery
1.System.Linq.IQueryable.get_Provider() +38
System.Linq.Queryable.Where(IQueryable1 source, Expression
1 predicate) +85
QueueOnWeb.Controllers.HomeController.LoginProcess(String name) in F:\WebProjects\QueueOnWeb\QueueOnWeb\QueueOnWeb\Controllers\HomeController.cs:369
QueueOnWeb.Controllers.HomeController.EnterName(LogonViewModel logonMode) in F:\WebProjects\QueueOnWeb\QueueOnWeb\QueueOnWeb\Controllers\HomeController.cs:327