Click here to Skip to main content
15,910,471 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
hi,

am in situation where in i need to pass data from windows service once event triggered from some external application[Sql].

i don`t have much idea on WCF services

i have following queries
is it possible to have callback contract between WCF service and Windows service?

Can someone please guide on how to proceed further

thanks in advance
Posted
Comments
lokesh v 2 28-May-12 4:34am    
am trying to implement messaging system where windows will pass some text data to WCF service on some event at windows service.

in this situation am thinking of Callback Contract between WCF and Windows Sservice. but am new to WCF and i dont know how to proceed with this

thanks

If your WCF is hosted in IIS then add a service reference to your windows service. Now it will create you a proxy.
Now you have to create a callback class and implement your CallbackContract Interface from WCF service. NOw when you create an instance of your service proxy, you have to give this callback implementation to the proxy constructor. Now when you call the WCF service, You will get the callback in your callback implementation.
 
Share this answer
 
Comments
Member 12203019 30-Dec-15 4:58am    
Hi guys,
I have the same problem so my WCF is hosted in Windows Service. Now i use another windows service for consume my WCF when starting. My WCF contain the method which throws my Windows Forms Application which throw the notification in the windows task bar.
So when i do it the notification not appear :

protected override void OnStart(string[] args)
{
MyServiceReference.Service1Client display = new MyServiceReference.Service1Client();
display.TestWCF();


}
Can you be more specific on this?
Can you explain your requirement?
 
Share this answer
 
Comments
lokesh v 2 28-May-12 4:45am    
am trying to implement messaging system where windows will pass some text data to WCF service on some event at windows service.

in this situation am thinking of Callback Contract between WCF and Windows Sservice. but am new to WCF and i dont know how to proceed with this

thanks
you can do this.
Now tell me if you have a wcf service already in place?
If yes then have a look into the service implementation to find out if there is any Callback contract defined.
Callback contract will be an Interface with [OperationContract] attribute on the callback methods.
This callback will be refered by the service contract.

Now find out how the wcf service is hosted. If it is hosted in IIS, Self hosted, within application...

Now answer to my questions and i can help you.
 
Share this answer
 
Comments
lokesh v 2 28-May-12 5:14am    
yes i have wcf service which contains Callback implemented between wcf service and Client.
i would like to have callback contract between WCF service and Windows service.

wcf is self hosted.

thanks
Member 12203019 31-Dec-15 10:04am    
Me, i have WCF which hosted in the First Windows service and i use second windows service to consume this WCF. My function TestWCF() launch the balloon tip. By if install the second service and when this starting the notification not appear . I don't use CallBack implemented.
My Function TestWCf :
public class Service1 : IService1
{
public void TestWCF()
{

Notification notif = new Notification();

notif.ShowNotification();
}

}

and my function ShowNotification :

namespace MyWPFApp
{
public class Notification
{
public void ShowNotification()
{
NotifyIcon notifyIcon;
notifyIcon = new NotifyIcon();
notifyIcon.Icon = SystemIcons.Information;
notifyIcon.BalloonTipTitle = "Atos !!!";
notifyIcon.BalloonTipText = "Atos Notification Center test";
notifyIcon.BalloonTipIcon = ToolTipIcon.Info;
notifyIcon.Visible = true;
notifyIcon.ShowBalloonTip(30000);
}
}
}

I want when the second service windows starting this launch the the Balloon tip Notification in the task bar icon

Help me !!!
My WCF app.config is :
<system.servicemodel>
<services>
<service name="AtosWCFService.Service1">
<host>
<baseAddresses>
<add baseaddress="http://localhost:8733/Design_Time_Addresses/AtosWCFService/Service1/">
</baseAddresses>

<!-- Service Endpoints -->
<!-- Unless fully qualified, address is relative to base address supplied above -->
<endpoint address="" binding="basicHttpBinding" contract="AtosWCFService.IService1">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<identity>
<dns value="localhost">


<!-- Metadata Endpoints -->
<!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. -->
<!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange">


<behaviors>
<servicebehaviors>
<behavior>
<!-- To avoid disclosing metadata information,
set the values below to false before deployment -->
<servicemetadata httpgetenabled="True" httpsgetenabled="True">
<!-- To receive exception details in faults for debugging purposes,
set the value below to true. Set to false before deployment
to avoid disclosing exception information -->
<servicedebug includeexceptiondetailinfaults="False">




Regards

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900