1

I am trying to host a WCF webservice at appharbor.com The service is responding as expected when hosted locally, but when build and hosted at appharbor, it only returns 404.

The service is running in a console application:

namespace Service.Host
{
    class Program
    {

        static void Main(string[] args)
        {

            var host = new ServiceHost<AchievementService>();

            host.Open();

            Console.WriteLine("AchievementService is running...\nPush any key to terminate.");
            Console.ReadLine();

            host.Close();
        }
    }
}

The app.config is looking like this:

<?xml version="1.0"?>
<configuration>
  <system.serviceModel>
   <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
    <services>
      <service name="Service.Main.AchievementService">
        <host>
          <baseAddresses>
            <add baseAddress="http://achiever.apphb.com"/>
            <!--<add baseAddress="http://localhost"/>-->
          </baseAddresses>
        </host>
        <endpoint address="AchievementService/"
                  behaviorConfiguration="RestBehavior"
                  binding="webHttpBinding"
                  contract="Service.Main.Contracts.IAchievementService"/>
        <endpoint address="mex" 
                  binding="mexHttpBinding" 
                  contract="IMetadataExchange" />
      </service>
    </services>

    <behaviors>
      <endpointBehaviors>
        <behavior name="RestBehavior">
          <webHttp helpEnabled="true" />
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior name="">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>

  </system.serviceModel>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
  </system.webServer>
</configuration>

If i use the baseaddress containing the value "http://localhost" i can access the get method, metadata, help etc in my webservice. But when i change it to achiever.apphb.com and builds it, i only receive 404 at http://achiever.apphb.com/AchievementService/ or http://achiever.apphb.com/

What I have tried is various configurations of addresses, i've tried localhost builded at appharbor with same result. I have also searched for examples, but i havn't found anything that could help me out with this problem.

The service is deployed and is not containing any tests, with the note from appharbor:

5/5/12 6:02 PM: Received notification, queuing build
5/5/12 6:02 PM: Downloading source
5/5/12 6:02 PM: Downloaded source in 0.27 seconds
5/5/12 6:02 PM: Starting build
5/5/12 6:02 PM: 0 warnings
5/5/12 6:02 PM: Build completed in 1.57 seconds Details
5/5/12 6:02 PM: Starting website precompilation
5/5/12 6:02 PM: Precompilation completed
5/5/12 6:02 PM: Starting tests
5/5/12 6:02 PM: Tests completed in 2.39 seconds
5/5/12 6:02 PM: Build successfully deployed
Tests

Build contains no tests
AndreasPK
  • 643
  • 5
  • 7
  • Is the build succeeding? – Ritch Melton May 05 '12 at 16:27
  • Yes, I have updated the question to reflect that. Good point though – AndreasPK May 05 '12 at 16:29
  • The only thing I can thing of is that your WCF host doesn't have the appropriate end points configured. I know you have an `app.config` but that doesn't mean its the correct one for the host. – Ritch Melton May 05 '12 at 20:09
  • As I understand, the endpoints configuration is how to access the webservice. Could you elaborate when you mean by appropriate endpoints configured? Each of the endpoints should be accessible. – AndreasPK May 05 '12 at 23:08
  • WCF services have to be hosted by something. For appharbor I assume its some sort of IIS configuration. – Ritch Melton May 06 '12 at 04:47

2 Answers2

0

Please check your build status and tests. If one of your tests was failed, the project cannot be deployed.

Peter PAD
  • 2,252
  • 1
  • 17
  • 20
0

I had trouble with metadata for the WCF service. But was able to see the WCF service was there using the *.svc location. Does http://achiever.apphb.com/AchievementService/[Name of your service].svc work for you?

Edit: Try this fix Hosting a WCF Web API app on AppHarbor?

Community
  • 1
  • 1
ShawnFeatherly
  • 2,470
  • 27
  • 20