Getting Started with Couchbase and C#
As soon as i run the application after doing the tutorial,
the following error shows up:
System.TypeInitializationException was unhandled
Message=The type initializer for 'Couchbase.CouchbaseClient' threw an exception.
Source=Couchbase
TypeName=Couchbase.CouchbaseClient
StackTrace:
at Couchbase.CouchbaseClient..ctor()
at ConsoleApp.Program.Main(String[] args) in C:\Users\lp\Documents\Visual Studio 2010\Projects\ConsoleApp\ConsoleApp\Program.cs:line 11
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.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: System.Configuration.ConfigurationErrorsException
Message=Configuration system failed to initialize
Source=System.Configuration
BareMessage=Configuration system failed to initialize
Line=0
StackTrace:
at System.Configuration.ConfigurationManager.PrepareConfigSystem()
at System.Configuration.ConfigurationManager.GetSection(String sectionName)
at System.Configuration.PrivilegedConfigurationManager.GetSection(String sectionName)
at System.Diagnostics.DiagnosticsConfiguration.GetConfigSection()
at System.Diagnostics.DiagnosticsConfiguration.Initialize()
at System.Diagnostics.DiagnosticsConfiguration.get_IndentSize()
at System.Diagnostics.TraceInternal.InitializeSettings()
at System.Diagnostics.TraceInternal.get_Listeners()
InnerException: System.Configuration.ConfigurationErrorsException
Message=Unrecognized configuration section membase. (C:\Users\lp\Documents\Visual Studio 2010\Projects\ConsoleApp\ConsoleApp\bin\Debug\ConsoleApp.vshost.exe.Config line 8)
Source=System.Configuration
BareMessage=Unrecognized configuration section membase.
Filename=C:\Users\lp\Documents\Visual Studio 2010\Projects\ConsoleApp\ConsoleApp\bin\Debug\ConsoleApp.vshost.exe.Config
Line=8
StackTrace:
at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal)
at System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(ConfigurationSchemaErrors schemaErrors)
at System.Configuration.BaseConfigurationRecord.ThrowIfInitErrors()
at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey)
InnerException: I should mention that i have removed the Enyim.Caching.dll reference,
if i do not remove it i get an error saying that StoreMode exists in both Enyim.Caching.dll and Couchbase.dll.
Anyone knows how to fix this?
I pretty much followed all the steps from the tutorial,
i wanted to try and insert some data into CouchBase trough a console app.
So i tought the tutorial would be a great place to start off.
My setup is pretty much identical to the tutorial one, the only difference is at step 8 i only added
the Couchbase.dll file , instead of both the Enyim.Caching.dll and the Couchbase.dll file.
This because of the reason u have mentioned, its causing a conflict somehow.
My config file and everything else is exactly the same as described in the tutorial.
Hi, I faced the exact same problem however instead of running in debug mode - I just ran the console program (ctrl + f5) - and so I was able to view the error message. My problem was that order of elements in the app.config was not right. The correct order is this:
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="couchbase" type="Couchbase.Configuration.CouchbaseClientSection, Couchbase"/>
</configSections>
<couchbase>
<servers bucket="default" bucketPassword="">
<add uri="http://xxx.xxx.xxx.xxx:8091/pools/default"/>
</servers>
</couchbase>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>
Also once I solved this problem, I was unable to store anything in the database. I installed version 1.8 and then chose membase instead of couchbase while you are doing setup (setup is done after installing couchbase). Then everything seems to work fine.
I think this is related to the fact that we've ILMerged the Enyim functionality into the Couchbase client.
It looks like perhaps there's a configuration difference between what you want to do with Enyim and what you're using the Couchbase client for? Can you describe the setup you're trying to achieve a bit and then I can probably help describe how to get there?