2

私は新しいAspNetCoreアプリケーションをmacOSで作成し、EFコアパッケージを追加します。 私は(DbContextクラス)()メソッドのSaveChangesメソッドを使用してデータベースにデータを保存しようと、次のエラーが表示されます。asp.net coreとSystem.Security.Cryptography.Native.Apple

"System.DllNotFoundException: Unable to load DLL 'System.Security.Cryptography.Native.Apple': The specified module could not be found."

私は、次の手順を使用してOpenSSLをインストールします。

  1. 醸造更新
  2. 醸造は、OpenSSLをインストール
  3. のln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylibは/ usr/local/lib/
  4. のln -sは/ usr/localは/ opt/opensslの/ libに/のlibssl。 1.0.0.dylib/usr/local/l IB/

OS:MacOSの(10.12.1)

project.json:

{ 
    "dependencies": { 
    "Microsoft.NETCore.App": { 
     "version": "1.0.1", 
     "type": "platform" 
    }, 
    "Microsoft.AspNetCore.Mvc": "1.0.1", 
    "Microsoft.AspNetCore.Routing": "1.0.1", 
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0", 
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.1", 
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0", 
    "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0", 
    "Microsoft.Extensions.Configuration.Json": "1.0.0", 
    "Microsoft.Extensions.Configuration.CommandLine": "1.0.0", 
    "Microsoft.Extensions.Logging": "1.1.0-preview1-final", 
    "Microsoft.Extensions.Logging.Console": "1.1.0-preview1-final", 
    "Microsoft.Extensions.Logging.Debug": "1.1.0-preview1-final", 
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0", 
    "Microsoft.EntityFrameworkCore": "1.1.0-preview1-final", 
    "Microsoft.Extensions.Logging.Abstractions": "1.1.0-preview1-final", 
    "Npgsql.EntityFrameworkCore.PostgreSQL": "1.0.2", 
    "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview3-final", 
    "Npgsql.EntityFrameworkCore.PostgreSQL.Design": "1.0.2", 
    "Microsoft.EntityFrameworkCore.Design": "1.1.0-preview1-final" 
    }, 
    "tools": { 
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final", 
    "Microsoft.EntityFrameworkCore.Tools.DotNet": "1.0.0-preview3-final", 
    "Microsoft.EntityFrameworkCore.Tools": { 
     "version": "1.0.0-preview3-final", 
     "imports": [ 
     "portable-net45+win8+dnxcore50", 
     "portable-net45+win8" 
     ] 
    } 
    }, 
    "frameworks": { 
    "netcoreapp1.0": { 
     "imports": [ 
     "dotnet5.6", 
     "portable-net45+win8" 
     ], 
     "buildOptions": { 
     "emitEntryPoint": true 
     } 
    } 
    }, 
    "buildOptions": { 
    "emitEntryPoint": true, 
    "preserveCompilationContext": true 
    }, 
    "runtimeOptions": { 
    "configProperties": { 
     "System.GC.Server": true 
    } 
    }, 
    "publishOptions": { 
    "include": [ 
     "wwwroot", 
     "**/*.cshtml", 
     "appsettings.json", 
     "web.config" 
    ] 
    }, 
    "scripts": { 
    "postpublish": [ 
     "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" 
    ] 
    }, 
    "tooling": { 
    "defaultNamespace": "TTT" 
    } 
} 

誰もが私が間違っているの何のアイデアを持っていますか?

ありがとうございました。

UPDATE(スタックトレース情報を追加)

fail: Microsoft.AspNetCore.Server.Kestrel[13] 
     Connection id "0HL01MGG6QKIE": An unhandled exception was thrown by the application. 
System.DllNotFoundException: Unable to load DLL 'System.Security.Cryptography.Native.Apple': The specified module could not be found. 
(Exception from HRESULT: 0x8007007E) 
    at Interop.AppleCrypto.DigestCreate(PAL_HashAlgorithm algorithm, Int32& cbDigest) 
    at Internal.Cryptography.HashProviderDispenser.AppleDigestProvider..ctor(PAL_HashAlgorithm algorithm) 
    at Internal.Cryptography.HashProviderDispenser.CreateHashProvider(String hashAlgorithmId) 
    at System.Security.Cryptography.MD5.Implementation..ctor() 
    at Npgsql.FrontendMessages.PasswordMessage.CreateMD5(String password, String username, Byte[] serverSalt) 
    at Npgsql.NpgsqlConnector.ProcessAuthenticationMessage(String username, AuthenticationRequestMessage msg) 
    at Npgsql.NpgsqlConnector.HandleAuthentication(String username, NpgsqlTimeout timeout) 
    at Npgsql.NpgsqlConnector.Open(NpgsqlTimeout timeout) 
    at Npgsql.ConnectorPool.Allocate(NpgsqlConnection conn, NpgsqlTimeout timeout) 
    at Npgsql.NpgsqlConnection.OpenInternal() 
    at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.Open() 
    at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.BeginTransaction(IsolationLevel isolationLevel) 
    at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.Execute(Tuple`2 parameters) 
    at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(IReadOnlyList`1 entriesToSave) 
    at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(Boolean acceptAllChangesOnSuccess) 
    at Microsoft.EntityFrameworkCore.DbContext.SaveChanges(Boolean acceptAllChangesOnSuccess) 
    at TTT.Controllers.ValuesController.Get(Int32 id) in /Users/cmaker-note/Projects/AspNetCore/TTT/Controllers/ValuesController.cs:line 26 
    at lambda_method(Closure , Object , Object[]) 
    at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeActionFilterAsync>d__28.MoveNext() 
--- End of stack trace from previous location where exception was thrown --- 
    at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeAsync>d__18.MoveNext() 
--- End of stack trace from previous location where exception was thrown --- 
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 
    at Microsoft.AspNetCore.Builder.RouterMiddleware.<Invoke>d__4.MoveNext() 
--- End of stack trace from previous location where exception was thrown --- 
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 
    at Microsoft.AspNetCore.Hosting.Internal.RequestServicesContainerMiddleware.<Invoke>d__3.MoveNext() 
--- End of stack trace from previous location where exception was thrown --- 
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 
    at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Frame`1.<RequestProcessingAsync>d__2.MoveNext() 
+0

.NET Coreランタイムが正しくインストールされていると仮定しますか? – Tseng

+0

はい。私はこの(https://www.microsoft.com/net/core#macos)の指示を使用しています。 – CMaker

答えて

1

私はあなたがそれが1 step.Hereを見逃していると思う:

brew link --force openssl 

すべてのステップ:

brew update 
brew install openssl 
brew link --force openssl 

リファレンス:dotnet restore (OSX)

+0

いいえ、これは私にとっては役に立ちません。 execコマンド( "brew link --force openssl")の後に、私はメッセージがあります: "keg-only opensslをリンクすると、安全でないものとリンクすることになるかもしれません..."。私はこのメッセージを探し始め、この問題がhttps://github.com/dotnet/cli/issues/3964#issuecomment-236493536であることを発見しました。私はリンクされたエラーだと思う。 – CMaker

+0

上記の私のポストにも参考リンクがありますか? – Sampath

+0

はい私はそれを入れて、execコマンドを試してみます。 – CMaker

1

私はそれが再び働いていた3つのすべてのために戻って、バージョン1.0.0に戻ったとき、私は

"Microsoft.Extensions.Logging": "1.1.0-preview1-final", 
"Microsoft.Extensions.Logging.Console": "1.1.0-preview1-final", 
"Microsoft.Extensions.Logging.Debug": "1.1.0-preview1-final", 

にこの

"Microsoft.Extensions.Logging": "1.0.0", 
"Microsoft.Extensions.Logging.Console": "1.0.0", 
"Microsoft.Extensions.Logging.Debug": "1.0.0", 

を更新し、同じ問題今夜がありました。

私はこの

"Microsoft.EntityFrameworkCore.Design": "1.1.0-preview1-final" 

への参照を追加し、それがバージョン1.1を望んでいたので、私はアップグレードした理由だった。*

"Microsoft.Extensions.Logging" 

ためとにかく、私は

"Microsoft.EntityFrameworkCore.Design": "1.1.0-preview1-final" 

を格下げ

"Microsoft.EntityFrameworkCore.Design": "1.0.1" 

そしてすべてが私にとって再び働いた。 1.1。*がプライムタイムの準備が整ったら、この問題は解消すると思います。

0

ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/ 
ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/ 

が実際に有効なファイルを指していることを確認してください。 私のために、homebrewはopensslパッケージをインストールしましたが、それをリンクしませんでした。 私はこれを信じています:

brew link --force openssl 

です。しかし、自家製はセキュリティの理由から自動的にこれを拒否します。ですから、単に.NetCoreを試してみたいのであれば、実際のインストール場所を指し示すだけかもしれません。どちらがいいですか:

/usr/local/Cellar/openssl/1.0.2k 

関連する問題