tags:

views:

14

answers:

2

i have the same app config on both programs
A - the service itself when i run it , wcf Test Client starts.
B - A self host program using -new ServiceHost(typeof(MyService)))

here it is :

<services>
  <service name="MyNameSpace.MyService"
           behaviorConfiguration="MyService.Service1Behavior">
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:5999/MyService"/&gt;
      </baseAddresses>
    </host>
    <endpoint
          binding="basicHttpBinding"
          contract="StorageServiceInterface.IService1"
          bindingConfiguration="MyBasicHttpBinding"
          name="basicEndPoint">

      <identity>
        <dns value="localhost"/>
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
  </service>
</services>


<bindings>
  <basicHttpBinding>
    <binding name="MyBasicHttpBinding">
      <security mode="None">
        <transport clientCredentialType="None" />
      </security>
    </binding>
  </basicHttpBinding>
</bindings>


<behaviors>
  <serviceBehaviors>
    <behavior name="HeziService.Service1Behavior">         
      <serviceMetadata httpGetEnabled="true"/>          
      <serviceDebug includeExceptionDetailInFaults="true"/>
    </behavior>
  </serviceBehaviors>
</behaviors>

the client Uses ClientBase<StorageServiceInterface.IService1>
Client app.config :

<system.serviceModel> 
    <client>
        <endpoint address="http://myIp/MyService"
                  binding="basicHttpBinding"
                  contract="StorageServiceInterface.IService1">                
        </endpoint>
    </client>
</system.serviceModel>

when i run the selfhost program and doing host.open()
it does open it, but when i try to call a method it tells me that :

"No connection could be made because the target machine actively refused it 10.0.0.1:5999"

ofcourse when the service run from the WCF Test Client, every thing working. how could it be ??

thanks in advance

A: 

Just guessing - how about adding an address to your server side endpoint:

<endpoint address="" .... >

Yes, the base address basically defines the whole address - but you should still add the address to your service endpoint - even if it's empty.

marc_s
didnt worked.. thanks though
yoni
A: 

something strange:

regards to marc_s that ask me to write my selfhost prog code..

i was using :

private void m_startServiceToolStripMenuItem_Click(object sender, EventArgs e)
{
using (Host = new ServiceHost(typeof(MyNameSpace.MyService)))
{
Host.Open();
}
}

before i've added it to the question i tried to change it without the using part :

private void m_startServiceToolStripMenuItem_Click(object sender, EventArgs e)
{
Host = new ServiceHost(typeof(yNameSpace.MyService));
Host.Open();
}

and its working !!

but, somehow it worked before...
thank you all anyway :-)

yoni
Well yes - the using().... will destroy the Host at the closing } and dispose it. So that's definitely not gonna work....
marc_s