2016-04-21 26 views
0

我在CentOS 7.1MissingMethodException与+ Npgsql的CLI DOTNET在CentOS 7.1连接

运行DOTNET CLI版本1.0.0-rc2-002439我建立的只是执行针对一个选择的原型控制台应用程序PostgreSQL 9.4数据库。

我只针对DNXCORE50和Windows,一切正常。当我运行它在CentOS我得到下面的异常上conn.Open()

Unhandled Exception: System.MissingMethodException: Method not found: 'Void System.Net.Security.SslStream.AuthenticateAsClient(System.String, System.Security.Cryptography.X509Certificates.X509CertificateCollection, System.Security.Authentication.SslProtocols, Boolean)'. 
at Npgsql.NpgsqlConnector.RawOpen(NpgsqlTimeout timeout) 
at Npgsql.NpgsqlConnector.Open(NpgsqlTimeout timeout) 
at Npgsql.NpgsqlConnector.Open() 
at Npgsql.NpgsqlConnectorPool.GetPooledConnector(NpgsqlConnection Connection) 
at Npgsql.NpgsqlConnectorPool.RequestConnector(NpgsqlConnection connection) 
at Npgsql.NpgsqlConnection.OpenInternal(NpgsqlTimeout timeout) 
at Npgsql.NpgsqlConnection.Open() 
at SensorBot.Core.Services.ConfigService.GetConfig() 
at ConsoleApplication.Program.Main(String[] args) 

这里是我使用的project.json:

{ 
    "version": "1.0.0-*", 
    "compilationOptions": { 
    "emitEntryPoint": false 
    }, 
    "dependencies": { 
    "Microsoft.NETCore.App": { 
     "version": "1.0.0-rc2-23811" 
    }, 
    }, 
    "runtimes": { "centos.7-x64": { } }, 
    "frameworks": { 
    "dnxcore50": { 
     "dependencies": { 
     "Microsoft.CSharp": "4.0.1-beta-23516", 
     "System.Collections": "4.0.11-beta-23516", 
     "System.Console": "4.0.0-beta-23516", 
     "System.Linq": "4.0.1-beta-23516", 
     "System.Threading": "4.0.11-beta-23516", 
     "System.IO": "4.1.0-*", 
     "System.IO.FileSystem": "4.0.1-rc2-23811", 
     "System.Runtime.Serialization.Primitives": "4.1.1-*", 
     "System.Dynamic.Runtime": "4.0.11-*", 
     "System.Net.Security": "4.0.0-beta-23405", 
     "System.Net.NetworkInformation": "4.1.0-beta-23405", 
     "System.Text.RegularExpressions": "4.0.12-rc2-23811", 
     "Npgsql": "3.1.0-alpha6" 
     } 
    } 
    } 
} 

我见过的Npgsql的的Github上,使用https://www.myget.org/gallery/npgsql-unstable作为一个包源代码,并使用Npgsql的不稳定版本修复它,但是当我使用"Npgsql": "3.1.0-unstable0458"时,该应用程序无法编译,并表示此版本的npgsql与DNXCore 5.0不兼容。

必须有一些我做错了,因为其他人似乎没有问题,这更多。

任何想法?

回答

0

我已经与版本Npgsql的同一异常3.1.0-alpha6

Unhandled Exception: System.MissingMethodException: Method not found: 'Void System.Net.Security.SslStream.AuthenticateAsClient(System.String, System.Security.Cryptography.X509Certificates.X509CertificateCollection, System.Security.Authentication.SslProtocols, Boolean)'.

但是我可以用两个版本的成功:3.1.0-unstable04583.1.0 -unstable0478
当前我正在使用Centos 7.2,Dotnet CLI版本1.0.0-rc2-002510。作为一个测试应用程序,我创建了一个简单的控制台应用程序,其中一个select到postgresql。
project.json看起来是这样的:

{ 
    "version": "1.0.0-*", 
    "compilationOptions": { 
    "emitEntryPoint": true 
    }, 
    "dependencies": { 
    "Microsoft.NETCore.App": { 
     "type": "platform", 
     "version": "1.0.0-rc2-23811" 
    }, 
    "Npgsql": "3.1.0-unstable0478" 
    }, 
"frameworks": { 
    "netcoreapp1.0": { 
     "imports": "dnxcore50", 
    } 
    } 
} 

因为我使用SSL连接到数据库,我不得不几个选项添加到我的连接字符串:SSL模式=要求;信任服务器证书= TRUE;使用SSL Stream = True

也许你应该尝试使用更新版本的dotnet cli。如果您对我的os/dotnet环境有任何疑问,请告诉我。