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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T12:46:11+00:00 2026-05-20T12:46:11+00:00

Okay. I’m having some conceptual issues with a WCF service i want to create.

  • 0

Okay. I’m having some conceptual issues with a WCF service i want to create. In short, I need to create a stand-alone Windows service that provides me with remoting functionality (replacing a .NET 1.1 remoting application).

Some general concepts as I currently understand them:

  1. I can do this by first creating a console app that provides the WCF hosting functionality.
  2. I would then deploy this console app as a service via the “create a service” mechanism available for .NET (using the IDE it’s pretty simple — this part is not difficult).

Edit: It might be better just to create a Windows Service and open the service host on the OnStart() and close it in the OnStop(). I will probably do this, but one of the things I’m finding confusing is that some of the examples I’m looking at talk about writing a simple console app versus this mechanism….

Here’s the current situation. We have an interface, I’ll call it IData which implements our calls to the SQL server. Currently, we implement IData in a class I’ll call RemData which has our basic Execute_Query and Execute_NonQuery methods.

Therefore, IData looks like:

[ServiceContract()]
public Interface IData
{
   [OperationContract()]
   int Execute_Query( parameter list....);  // parameter list shouldn't be important here I hope.

   [OperationContract()]
   int Execute_NonQuery( parameter list....);
}

Note how in my interface definitions, I added the attributes for the WCF stuff (Service Contract and OperationContract). This is central to one of my questions below.

RemData implements IData. We build it sepearately as a DLL.

Now, I need to implment the WCF so I create a console app and include a reference to the DLL containing the definition for my interface IData and a reference to the DLL for RemData (yes, they are in two separate assemblies for me).

Here’s the tricky part for me. I need to implment the service, so I’m thinking I can do it in this way. First I modify the RemData class and add System.ServiceModel as a reference and then decorate the class with the [ServiceBehavior()] attribute and then add the [OperationBehavior()] attributes to each of the methods matching my Interface.

  1. Is this a good plan of attack?

  2. If I do this plan, do I then decorate the class with the [ServiceBehavior()] attribute and then each method in the class with the [OperationBehavior()] attribute? Do I even need the OperationBehavior attribute at all? I’m pretty sure I need the ServiceBehavior attribute, though.

  3. These would then more or less match the ServiceContract and OperationContract attributes on the interface, right?

  4. What if I have multiple overloaded Execute_Query() and Execute_NonQuery() methods in the original (which I do). I know how to define them in the interface using the Name parameter in the OperationContract attribute:

    [ServiceContract()]
    public Interface IData
    {
    [OperationContract(Name=”Execute_QueryA”)]
    int Execute_Query( parameter list….); // parameter list shouldn’t be important here I hope.

    [OperationContract(Name=”Execute_NonQueryA”)]
    int Execute_NonQuery( parameter list….);

    [OperationContract(Name=”Execute_QueryB”)]
    int Execute_Query( parameter list….); // parameter list shouldn’t be important here I hope.

    [OperationContract(Name=”Execute_NonQueryB”)]
    int Execute_NonQuery( parameter list….);

    }

  5. But, what do I do for the actual implementation? Do I just leave the [OperationBehavior()] execute as it stands and not add any parameters to it? There doesn’t seem to be a name parameter.

I’d appreciate any thoughts on this or links to good articles because I’m not finding a whole lot of useful information that goes beyond the basic “Hey, I created a single call WCF service hosted in IIS …”

Thank you.

  • 1 1 Answer
  • 2 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-20T12:46:12+00:00Added an answer on May 20, 2026 at 12:46 pm

    Your plan is fine, but you probably don’t need to decorate each method implementation with [OperationBehavior] unless they’re doing something special.

    Your overloads will need to have unique parameters, though, or else you must give them different names, eg:

    [OperationContract()]
    int Execute_NonQueryA( parameter list );
    
    [OperationContract()]
    int Execute_NonQueryB( parameter list);
    

    The name attribute of OperationContract is not meant to enable multiple overrides of methods that have the same C# signature, it’s only meant to rename the method from the perspective of the caller.

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

Sidebar

Related Questions

Okay so I am having some issues when doing some NSXMLParsing. The parsers are
Okay I am having some problems with being able to change bitmaps when a
Okay I got some good advice for Mobile Detection but still having an issue
Okay, I feel a bit foolish for having to ask this but I guess
Okay, I have the following create action #posts_controller, nested resource under discussions def create
Okay, I have setup up a handler for a div click but for some
okay so I have two arrays $array_one([a]=>2,[b]=>1,[c]=>1); $array_two([a]=>1,[b]=>2,[c]=>1); I want to be able to
Okay so I currently have: /(#([\]))/g; I want to be able to check for
Okay So this doesnt make sense to me.... maybe someone can shed some light.
Okay, so I'm trying to create a Order Posts by Type using jQuery JSON

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.