c# - Call WCF - Host from Windows application -


i have 4 projects in solution. 2 wcf service library projects called getdetfromdb, modifydbservice, 1 console application has reference of these wcf service libraries , windows application call wcf service.

i made reference of console app in windows app. able call client app window app.

but how can invoke services referred in console app calling windows app?

note: when press f5 or debugger-->start new instance both service runs correctly console. configured binding,endpoints address correctly. want how call programmatically.

here console application code:

namespace servicehostconsole {     public class program     {         static void main(string[] args)         {             console.writeline("enter start");             console.read();              type servicetype = typeof(getdetfromdb.impservice);             type servicemodifydb = typeof(modifydbservice.manipulate);              servicehost host1 = new servicehost(servicemodifydb);             host1.open();              using (servicehost host = new servicehost(servicetype))             {                 host.open();                  console.writeline("the product service available");                 console.readline(); host.close();             }              console.writeline("please enter close modify service");             console.read();             host1.close();         }          public string returnpath()         {             string folder = environment.currentdirectory;             return folder;         }     } } 

from windows application calling ....

 public form1()  {       initializecomponent();        servicehostconsole.program pb = new servicehostconsole.program();       process.start(pb.returnpath()+ @"\servicehostconsole.exe");  } 

now getting following error when program tries open service..

service 'modifydbservice.manipulate' has 0 application (non-infrastructure) endpoints. might because no configuration file found application, or because no service element matching service name found in configuration file, or because no endpoints defined in service element

i suspecting calling blindly method , not invoking service.

kindly me out of issue, have been struggling past 5 days this.

i need publish windows application , when click setup both windows application , client application invoked services should open. requirement.

my app.config of servicehostconsole this,

<?xml version="1.0" encoding="utf-8" ?> <configuration>     <system.servicemodel>         <services>             <service name="getdetfromdb.impservice">                 <endpoint address="http://localhost:8080/myservice" binding="basichttpbinding"                     bindingconfiguration="" contract="getdetfromdb.igetexpensevaluestype" />             </service>             <service name="modifydbservice.manipulate">                 <endpoint address="http://localhost:8081/myservice1." binding="basichttpbinding"                     bindingconfiguration="" contract="modifydbservice.imanipulatedb" />             </service>         </services>     </system.servicemodel> </configuration> 

do not reference wcf service libraries. should referenced projects host services.

instead, should use "add service reference" reference services.

see "how consume web service".


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -