MongoDB ASP.NET Session Store Provider v1.1.0

Since I created the MongoDB ASP.NET Session State Store Provider (v1.0.0), a few things have moved on in the MongoDB C# Driver. I’ve pushed a number of changes up to the project on GitHub (which I’ve incremented to v1.1.0), so it now uses v1.7.0.4714 of the driver. There is no change to way it is configured in web.config, so if you are using v1.0.0 of my provider it should be painless. Of course, I’d recommend thorough testing first :)

The changes relate to:

web.config recap

These web.config settings have not changed, so should continue working as before.

<configuration>  
  <connectionStrings>  
    <add name="MongoSessionServices" connectionString="mongodb://localhost" />  
  </connectionStrings>  
  <system.web>  
    <sessionState  
        mode="Custom"  
        customProvider="MongoSessionStateProvider">  
      <providers>  
        <add name="MongoSessionStateProvider"  
             type="MongoSessionStateStore.MongoSessionStateStore"  
             connectionStringName="MongoSessionServices"  
             writeExceptionsToEventLog="false"  
             fsync="false"  
             replicasToWrite="0" />  
      </providers>  
    </sessionState>  
  </system.web>  
</configuration>  

replicasToWrite is interpreted as follows:
< 0 = ignored. Treated as 0.
0 = will wait for acknowledgement from primary node.
> 0 = will wait for writes to be acknowledged from (1 + {replicasToWrite}) nodes.

Please Note, per the MongoDB Driver docs, if (1 + {replicasToWrite}) equates to a number greater than the number of replica set members that hold data, then MongoDB waits for the non-existent members to become available (so blocks indefinitely).

It still treats write concerns as important, ensuring it waits for acknowledgement back from at least one MongoDB node.

As always, all feedback welcome.


See also