c# - How to consume Windows Communication Foundation (WCF) by a Windows Service -
When I get a Windows service Web application (ASP.) > To set up some work in the client machine, Net C # )
To serve WCF from a web application, I used to refer to the WCF for Window Service Project as a reference Added context, everything looks fine, updated the app.config file, added service reference etc. It was not working. Any idea would be very useful.
My code is shown below
string result = string Empty; BasicHttpBinding myBinding = New BasicHttpBinding (); Endpoint Address My Idpoint = New Endpoint Reader ("http://test.com/Service.svc/DevicesService"); (Using the Chainfacturing & lt; Idviss services & gt; myChannelFactory = New Channel Factor & lt; ID Developers Services & gt; (MyBanding, MyInndpoint)). {IDevicesService wcfClient1 = myChannelFactory.CreateChannel (); Results = wcfClient1.CheckNetworkConnection (IPLocalHost); If (! String.InsnaleOrcti (results) and results, Ekl (IPOLOKHLHOST)) {event log. Wight Entry ("Test Connection Success"); } And {EventLog.WriteEntry ("currently no live connection is available"); } ((IClientChannel) wcfClient1). Stop it (); }
To create a console application, when I created a window service I find it easy to do the same thing as a service; I find out the actual working code (your code snippet above) in a separate assembly and then it only opens the main method of my service or the main method of the console .
If you take up your code above the console application, does this work? If it does not happen, can you take action through it and tell us where it fails. And when this fails, what are you looking at the exception information?
Let us know and we will help
Comments
Post a Comment