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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:25:50+00:00 2026-05-13T06:25:50+00:00

I just read a fantastic article about WCF transactions and flow. Pretty much only

  • 0

I just read a fantastic article about WCF transactions and flow. Pretty much only left me with one unanswered question:

I have a single project with two service methods defined:

ServiceA.svc

   [OperationBehavior(TransactionScopeRequired = true)]
   OperationA()


ServiceB.svc

  [OperationBehavior(TransactionScopeRequired = true)]
  OperationB()

OperationA() needs to call OperationB().

I could quite easily just say new ServiceB().OperationB(...) from within ServiceA (remember i said they are in the same web project running on the same server.

At first I thought this is what I would do, but I’m not sure if transactions will all get screwed up or not – especially if the transaction contracts differed between the two operations. Obviously if I’m accessing Transaction.Current from within OperationB then it will exist, but if the two operations had diffrent contracts (as described in the referenced article) the rules would not be followed.

What’s the correct way for ServiceA.OperationA() to call ServiceB.OperationB()?

(Curious also how to do this when one operation calls another in the same class, but thats probably an easier thing to google for)

  • 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-13T06:25:50+00:00Added an answer on May 13, 2026 at 6:25 am

    The basic assumption with WCF is that you always call a service method through a client proxy. This behavior allows the WCF runtime to get into the call stack and do all its magic.

    So in your case, if you want to call ServiceB from ServiceA, you should create a client proxy for ServiceB inside ServiceA and call ServiceBClientProxy.OperationB() on that client proxy.

    You can create a client proxy in several ways:

    • through the Visual Studio “Add Service Reference” dialog, which under the covers just basically calls the svcutil.exe command line utility, which you can also call directly. This creates nice proxies and all, but horrible configs

    • since these two services are in the same project, both will have access to each other’s contracts, right? In that case, you can manually create a client proxy in a few lines of code.

    Basically, what you need is a ChannelFactory<T> instance for your ServiceB’s service contract, and then you call the CreateChannel() method on that channel factory to get the actual channel (= the client proxy) for that service. Something like this:

     ChannelFactory<IServiceB> factory = new ChannelFactory<IServiceB>();
     IServiceB clientProxy = factory.CreateChannel();
    

    This takes all the details from the web.config – if you want, you could define bindings and endpoints in code and pass them into the constructor for the ChannelFactory.

    Now you have a client proxy for ServiceB and you can call all its methods. That’s the proper way of doing it in WCF.

    Hope this helps a bit!

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

Sidebar

Related Questions

I just read an article and saw and only one MSIL instruction that loads
I just read this article and I pretty much got it, although there is
I just read in an article about JIT Compilation that Java has two modes
I just read an article in the BlackBerry docs about writing efficient code in
I just read Ben Alman 's article on Immediately-Invoked Function Expressions and wondered about
I just read this topic about the Magento payment flow. It handles about the
I just read the wiki article about CRTP , and I'm a little confused
I just read an article on www.songho.ca which indicates that a projection matrix is
I just read in Code Complete that you should not use exceptions for flow
I just read this great answer from BalusC about how to upload files with

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.