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 7163159
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:51:18+00:00 2026-05-28T13:51:18+00:00

Just wondering what other’s thoughts are on using a TransactionScope in an IHttpModule. For

  • 0

Just wondering what other’s thoughts are on using a TransactionScope in an IHttpModule.
For example:

BeginRequest
//start new TransactionScope
// start UOW
// Begin UOW transaction

// do some stuff...


EndRequest:
// commit UOW
// commit transaction scope

Is it really a wise idea to hold the transactionscope open for the life of a http request?
I need to write to transactional MSMQ at the same time and have the need for the TransactionScope. I’d like db updates to be persisted as well as MSMQ messages to be sent, or else, roll it all back…

Any advice?

  • 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-05-28T13:51:19+00:00Added an answer on May 28, 2026 at 1:51 pm

    This would fail randomly because in ASP.NET there is no guarantee that BeginRequest and EndRequest will occur on the same thread (aka thread-agility). A Transaction scope will throw an exception if you try to dispose of it on a different thread than the one where it was created. So in the occasional event that EndRequest executed on a different thread then BeginRequest, this exception was thrown.

    For more detail:

    http://www.mattwrock.com/post/2010/12/26/Getting-TransactionScope-to-play-nice-with-NHibernate.aspx

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

Sidebar

Related Questions

I'm just wondering how other developers tackle this issue of getting 2 or 3
Was just wondering how do these sites (and many other softwares that generate flash
I use log4net in just about every code project. I was wondering what other
I was wondering if there was any decent way, other than NSLog-ing just about
Silly question really but just was wondering about other peoples naming conventions for DAL
I was just wondering if there was a way to use System.out.println(); or other
Just wondering if this and other related functions like those Integer is one of
Just wondering in case of Asynchronous TCP or other EAP pattern, if the success
I was just wondering about something, I'm working on a project with several other
Just wondering, is it necessary to programmatically create a new thread in a situation

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.