2
votes

I have a VB.NET WCF service hosted as a Window Service. I was able to create an install package, install the service to my machine, and start the service manually from Services in Administrative Tools.

Now when I try to reference the service in my test console application (Address: http://localhost:8080/), I get the following error:

There was an error downloading 'http://localhost:8080'.`

Unable to connect to the remote server No connection could be made because the target machine actively refused it 127.0.0.1:8080`

Metadata contains a reference that cannot be resolved: 'http://localhost:8080/'. Could not connect to http://localhost:8080/. TCP error code 10061: No connection could be made because the target machine actively refused it 127.0.0.1:8080. Unable to connect to the remote server No connection could be made because the target machine actively refused it 127.0.0.1:8080 If the service is defined in the current solution, try building the solution and adding the service reference again.

Not sure what I can do about this. Any ideas???

Thanks, Jason.

Here's the code from app.config inside my service:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
   <system.diagnostics>
      <sources>
         <!-- This section defines the logging configuration for My.Application.Log -->
         <source name="DefaultSource" switchName="DefaultSwitch">
            <listeners>
                <add name="FileLog"/>
                <!-- Uncomment the below section to write to the Application Event Log -->
                <!--<add name="EventLog"/>-->
            </listeners>
         </source>
       </sources>
       <switches>
          <add name="DefaultSwitch" value="Information" />
       </switches>
       <sharedListeners>
          <add name="FileLog"
               type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" 
               initializeData="FileLogWriter"/>
       </sharedListeners>
   </system.diagnostics>

   <system.serviceModel>
      <services>
         <service name="ExStreamWCF.Service1" 
                  behaviorConfiguration="ExStreamWCF.Service1Behavior">
            <!-- Service Endpoints -->
            <host>
               <baseAddresses>
                   <add baseAddress = "http://localhost:8080/Design_Time_Addresses/JasonsService/Service/" />
               </baseAddresses>
            </host>
            <endpoint address="" binding="wsHttpBinding" contract="ExStreamWCF.IService1">
               <identity>
                  <dns value="localhost"/>
               </identity>
            </endpoint>
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
         </service>
      </services>
      <behaviors>
         <serviceBehaviors>
            <behavior name="ExStreamWCF.Service1Behavior">
               <serviceMetadata httpGetEnabled="true"/>
               <serviceDebug includeExceptionDetailInFaults="false"/>
            </behavior>
         </serviceBehaviors>
      </behaviors>
   </system.serviceModel>
</configuration>

If anyone needs more from me please let me know!

1

1 Answers

0
votes

Not sure if it's really an issue - but on a production server, I would never use localhost as my base address.

So can you try to change:

<service name="ExStreamWCF.Service1" 
         behaviorConfiguration="ExStreamWCF.Service1Behavior">
   <host>
      <baseAddresses>
         <add baseAddress = "http://localhost:8080/Design_Time_Addresses/JasonsService/Service/" />
      </baseAddresses>
   </host>

to

<service name="ExStreamWCF.Service1" 
         behaviorConfiguration="ExStreamWCF.Service1Behavior">
   <host>
      <baseAddresses>
         <add baseAddress = "http://YourServerName:8080/Design_Time_Addresses/JasonsService/Service/" />
      </baseAddresses>
   </host>

Does that make any difference when calling into the service??