Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8310519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T19:29:17+00:00 2026-06-08T19:29:17+00:00

Issue context: Have a piece of code that’s trying to add a new document

  • 0

Issue context:
Have a piece of code that’s trying to add a new document to RavenDB in an NServiceBus message handler.

The code:

partial void HandleImplementation(SomeMessage message)
{
    PutDataIntoCache(message.CacheKey, message.Document);
}

void PutDataIntoCache(string key, Document document)
{
    using (var documentStore = new DocumentStore { Url = "http://localhost:8084" })
    {
            documentStore.Initialize();
            using (IDocumentSession session = documentStore.OpenSession())
            {
                using (var tx = new TransactionScope())
                {
                    session.Store(document, key);
                    session.SaveChanges();
                    tx.Complete();
                }
        }
    }
}

The error

I'm getting the following error:
Raven.Abstractions.Exceptions.ConcurrencyException: A document with key: 'cache-fncwr10b' is currently created in another transaction
   at Raven.Client.Connection.ServerClient.DirectBatch(IEnumerable`1 commandDatas, String operationUrl) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Connection\ServerClient.cs:line 863
   at Raven.Client.Connection.ServerClient.<>c__DisplayClass56.<Batch>b__55(String u) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Connection\ServerClient.cs:line 837
   at Raven.Client.Connection.ServerClient.TryOperation[T](Func`2 operation, String operationUrl, Boolean avoidThrowing, T& result) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Connection\ServerClient.cs:line 222
   at Raven.Client.Connection.ServerClient.ExecuteWithReplication[T](String method, Func`2 operation) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Connection\ServerClient.cs:line 192
   at Raven.Client.Connection.ServerClient.Batch(IEnumerable`1 commandDatas) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Connection\ServerClient.cs:line 837
   at Raven.Client.Document.DocumentSession.SaveChanges() in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Document\DocumentSession.cs:line 441
   at CacheWarmer.Listener.Caching.UpdateCacheEntryProcessor.PutDataIntoCache(String key, ConfgDataModel confgDataModel) in UpdateCacheEntryProcessor.cs

The question
Has anyone run across this? How did you solve it? What could be causing this?

Any helpful comments or tips will be greatly appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T19:29:19+00:00Added an answer on June 8, 2026 at 7:29 pm

    Also, do NOT create a new DocumentStore on every call.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's the context of this issue: I have a Grails class: class User{ long
I am having a strange issue. I have a very simple piece of code
Here's the issue: I have 2 data contexts that I would like to do
So I have an issue, when I load a document, I have a class
Hi I have a code that reads a text file and copies the content
I am using the following piece of code to populate my ListView - setListAdapter(new
I'm trying to have my context menu stay on screen even after I click
I have following piece of code: byte[] snapthotBytes, snapthotBytes2; string stringOutput, stringOutput2; IInvestigationDump investigationDump
We have a piece of code which saves a .Net System.Drawing.Bitmap to file. The
My issue is that sometimes a piece of JavaScript (often Google Analytics) may take

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.