tags:

views:

86

answers:

2

Hi All,

I have developed a wcf service, and i have hosted it in IIS, the svc file is as followed

<%@ ServiceHost Language="C#" Debug="true" Service="ServiceImplemetation.HelloService" %>

and the web.config file's system.servicemodel section is as follows:

<system.serviceModel>
  <behaviors>
    <serviceBehaviors>
      <behavior name="MetadataBehavior">
        <serviceMetadata httpGetEnabled="true" />
      </behavior>
      <behavior name="WebApplication1.Service1Behavior">
        <serviceMetadata httpGetEnabled="true" />
        <serviceDebug includeExceptionDetailInFaults="false" />
      </behavior>
      <behavior name="WebApplication1.MyHelloBehavior">
        <serviceMetadata httpGetEnabled="true" />
        <serviceDebug includeExceptionDetailInFaults="false" />
      </behavior>
    </serviceBehaviors>
  </behaviors>
  <services>
     <service name="ServiceImplemetation.HelloService"
              behaviorConfiguration="MetadataBehavior">
        <endpoint address="" 
                  binding="basicHttpBinding" 
                  contract="ServiceContracts.IHello" />
        <endpoint address="mex" 
                  binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
           <baseAddresses>

the service is running fine, now i have created a web client to consume the service and have written the cleint section of web.config file as follows:

<system.serviceModel>
  <behaviors>
    <endpointBehaviors>
      <behavior name="wsServiceBehaviour">
         <dataContractSerializer maxItemsInObjectGraph="6553600"/>
      </behavior>
    </endpointBehaviors>
  </behaviors>
  <client>
    <endpoint address="http://localhost:8379/HelloService/" 
              binding="basicHttpBinding" 
              behaviorConfiguration="wsServiceBehaviour" 
              contract="ServiceContracts.IHello" 
              name="BasicHttpBinding_IIHello" />
  </client>
</system.serviceModel>

Now when i am accessing this service i am getting the following error :

No connection could be made because the target machine actively refused it 127.0.0.1:8379

I am guessing it's a problem of wrong address , but i don't know where is the mistake ... can someone pls have a look on this problem ...

A: 

Usually, IIS is configured to run on port 80 and not on port 8379. I think that is the problem.

Ronald Wildenberg
+1  A: 

If you host in IIS, you cannot use your own base addresses - your service URL will be the URL of the virtual directory which holds your SVC file, plus the SVC file, plus any relative address on your service endpoint.

In your that, you should connect to:

http://myserver/MyVirtualDirectory/MyService.svc/

Any configured "base addresses" in your system.serviceModel section (which you left out, unfortunately) will be useless if you use IIS to host your WCF service.

Marc

marc_s