1
私はVisual Studio for Macで安心してサービスを開発しています。私のローカルMongoDBインスタンス(起動している)に接続するために、MongoDB NuGetパッケージをインストールしました。クラスは、私はそれが次のエラーで応答し、接続を実行しようとただしたら、コードに正しく参照されています.NET on OSX(Mono):MongoDBに接続できません
{
"Message": "An error has occurred.",
"ExceptionMessage": "An error occurred when trying to create a controller of type 'BalanzaController'. Make sure that the controller has a parameterless public constructor.",
"ExceptionType": "System.InvalidOperationException",
"StackTrace": " at System.Web.Http.Dispatcher.DefaultHttpControllerActivator.Create (System.Net.Http.HttpRequestMessage request, System.Web.Http.Controllers.HttpControllerDescriptor controllerDescriptor, System.Type controllerType) [0x000f3] in <f99f496cb0d249c1a945c1fcabce1695>:0 \n at System.Web.Http.Controllers.HttpControllerDescriptor.CreateController (System.Net.Http.HttpRequestMessage request) [0x00028] in <f99f496cb0d249c1a945c1fcabce1695>:0 \n at System.Web.Http.Dispatcher.HttpControllerDispatcher+<SendAsync>d__1.MoveNext() [0x000a9] in <f99f496cb0d249c1a945c1fcabce1695>:0 ",
"InnerException": {
"Message": "An error has occurred.",
"ExceptionMessage": "ntdll.dll",
"ExceptionType": "System.DllNotFoundException",
"StackTrace": " at (wrapper managed-to-native) Interop+NtDll:RtlGetVersion (Interop/NtDll/RTL_OSVERSIONINFOEX&)\n at Interop+NtDll.RtlGetVersion() [0x0001a] in <f13660f89d0d419fba4e315693dd26ea>:0 \n at System.Runtime.InteropServices.RuntimeInformation.get_OSDescription() [0x00007] in <f13660f89d0d419fba4e315693dd26ea>:0 \n at MongoDB.Driver.Core.Connections.ClientDocumentHelper.CreateOSDocument() [0x00042] in <2c531fdd26874b5eb450bd126d409101>:0 \n at System.Lazy`1[T].CreateValue() [0x00075] in /private/tmp/source-mono-4.8.0/bockbuild-mono-4.8.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/Lazy.cs:437 "
}
}
それは何とか正しいdllファイル(またはモノラル環境での特派員)を見つけるに失敗しました。
どうすれば修正できますか?
おかげ
追加したNuGetパッケージのフルネームは何ですか?誰もがモノで使用できるわけではありません。 –
'MongoDB.Driver'は正式であると主張されています。これは 'package.config'で得られるものです: –
balanza
あなたのpackage.configが間違っています。 「net45」は、Windowsのみの.NET Framework 4.5以上を意味します。 Monoで使用するには、targetFrameworkを.NET Standard、http://mongodb.github.io/mongo-csharp-driver/2.4/getting_started/installation/に変更してから、csprojファイルを手動で編集して参照アセンブリ。 NuGetはMono == .NET Frameworkと考えていたかもしれませんが、そうではありません。 –