Note that there are some explanatory texts on larger screens.

plurals
  1. POWCF Console Application Stand-Alone/Standalone Service
    primarykey
    data
    text
    <p>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). </p> <p>Some general concepts as I currently understand them:</p> <ol> <li>I can do this by first creating a console app that provides the WCF hosting functionality.</li> <li>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).</li> </ol> <p>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....</p> <p>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.</p> <p>Therefore, IData looks like:</p> <pre><code>[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....); } </code></pre> <p>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.</p> <p>RemData implements IData. We build it sepearately as a DLL.</p> <p>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).</p> <p>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.</p> <ol> <li><p>Is this a good plan of attack?</p></li> <li><p>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.</p></li> <li><p>These would then more or less match the ServiceContract and OperationContract attributes on the interface, right?</p></li> <li><p>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:</p> <p>[ServiceContract()] public Interface IData { [OperationContract(Name="Execute_QueryA")] int Execute_Query( parameter list....); // parameter list shouldn't be important here I hope.</p> <p>[OperationContract(Name="Execute_NonQueryA")] int Execute_NonQuery( parameter list....);</p> <p>[OperationContract(Name="Execute_QueryB")] int Execute_Query( parameter list....); // parameter list shouldn't be important here I hope.</p> <p>[OperationContract(Name="Execute_NonQueryB")] int Execute_NonQuery( parameter list....);</p> <p>}</p></li> <li><p>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.</p></li> </ol> <p>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 ..."</p> <p>Thank you.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload