Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Session state on couchbase

I want to use couchbase for session. I configured my web config. Also app framework is net 4.5. Here is my web.config

<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=301880
  -->
<configuration>
  <configSections>
    <section name="couchbase-caching" type="Couchbase.Configuration.Client.Providers.CouchbaseClientSection, Couchbase.NetClient" />
  </configSections>

  <appSettings>
    <add key="webpages:Version" value="3.0.0.0" />
    <add key="webpages:Enabled" value="false" />
     <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
  </appSettings>

  <couchbase-caching>
    <servers bucket="session" bucketPassword="">
      <add uri="*********************" />
    </servers>
  </couchbase-caching>

  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />

    <sessionState customProvider="Couchbase" mode="Custom">
      <providers>
        <add name="Couchbase" type="Couchbase.AspNet.SessionState.CouchbaseSessionStateProvider, Couchbase.AspNet" section="couchbase-caching" factory="Couchbase.AspNet.CouchbaseClientFactory" exclusiveAccess="false" />
      </providers>
    </sessionState>

  </system.web>

  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true" />
  </system.webServer>

  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

I cant find why get this error. When i want to run it then i get this error :

error

Can anyone help me, thanks.

like image 287
Just Ersoy Avatar asked Sep 03 '26 15:09

Just Ersoy


2 Answers

I had a similar problem and the configuration below worked for me. "Bucket" should be an element, not an attribute and the attribute "bucketPassword" should be "password".

<couchbase-caching>
    <servers>
        <add uri="*********************" />
    </servers>
    <buckets>
        <add name = "session" password=""> </add>
    </buckets>
</couchbase-caching>
like image 175
user2765864 Avatar answered Sep 05 '26 04:09

user2765864


Here is my solution. If anyone use .net 4.5 can download it. https://github.com/couchbaselabs/couchbase-aspnet/tree/2.0

like image 30
Just Ersoy Avatar answered Sep 05 '26 03:09

Just Ersoy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!