Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7559129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:33:27+00:00 2026-05-30T12:33:27+00:00

Environment: Windows XP, Visual Studio 2010, IIS NOT installed. I’ve developed a WCF service

  • 0

Environment: Windows XP, Visual Studio 2010, IIS NOT installed.

I’ve developed a WCF service as a library that works fine when hosted in WCFSvcHost; I can connect to it, update a client’s service reference, the works.

I’m unable to to host it as a Windows Service, though. The service installs okay, I can attach to it and break in my code. In order to debug the hosting, I’ve moved the code to OnResume() (OnStart does nothing).

Here’s my OnResume (names have been changed to protect the innocent):

protected override OnResume()
{
    if (_selfHost == null)
    {
        _selfHost = new ServiceHost(typeof(MyService));
        _selfHost.Open();
    }
}

When stepping over the Open() method, I get the following exception:

System.InvalidOperationException was unhandled by user code
  Message=The HttpGetEnabled property of ServiceMetadataBehavior is set to true and the HttpGetUrl property is a relative address, but there is no http base address.  Either supply an http base address or set HttpGetUrl to an absolute address.
  Source=System.ServiceModel
  StackTrace:
       at System.ServiceModel.Description.ServiceMetadataBehavior.EnsureGetDispatcher(ServiceHostBase host, ServiceMetadataExtension mex, Uri url, String scheme)
       at System.ServiceModel.Description.ServiceMetadataBehavior.CreateHttpGetEndpoints(ServiceDescription description, ServiceHostBase host, ServiceMetadataExtension mex)
       at System.ServiceModel.Description.ServiceMetadataBehavior.ApplyBehavior(ServiceDescription description, ServiceHostBase host)
       at System.ServiceModel.Description.ServiceMetadataBehavior.System.ServiceModel.Description.IServiceBehavior.ApplyDispatchBehavior(ServiceDescription description, ServiceHostBase serviceHostBase)
       at System.ServiceModel.Description.DispatcherBuilder.InitializeServiceHost(ServiceDescription description, ServiceHostBase serviceHost)
       at System.ServiceModel.ServiceHostBase.InitializeRuntime()
       at System.ServiceModel.ServiceHostBase.OnBeginOpen()
       at System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout)
       at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
       at System.ServiceModel.Channels.CommunicationObject.Open()
       at MyService.StartService()
       at MyService.OnContinue()
       at System.ServiceProcess.ServiceBase.DeferredContinue()
  InnerException: 

No amount of changing my config file seems to solve the problem:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" />
  </startup>
  <system.web>
    <compilation debug="true" />
  </system.web>
  <system.serviceModel>
    <services>
      <service name="MyService">
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8732/MyService/" />
          </baseAddresses>
        </host>
        <endpoint address="" binding="wsHttpBinding" contract="MyLib.IMyService">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="http://localhost:8732/MyService/mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpGetEnabled="True" />
          <serviceDebug includeExceptionDetailInFaults="False" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>

As a test, I’ve tried to set httpGetEnabled to False and to remove the mex endpoint, but that only moved the problem elsewhere: the error message goes away and the service starts, but then my client can’t call the service:

System.ServiceModel.EndpointNotFoundException was caught
  Message=There was no endpoint listening at http://localhost:8732/MyService/ that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
[...]

  InnerException: System.Net.WebException
       Message=The remote server returned an error: (400) Bad Request.
       Source=System
       StackTrace:
            at System.Net.HttpWebRequest.GetResponse()
            at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
       InnerException: 

Any help?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T12:33:29+00:00Added an answer on May 30, 2026 at 12:33 pm

    Got it.

    I had incorrectly copied the relevant section from the config file, not once, but twice (both in the windows service and the console app).

    Thanks Terry. You got me thinking along the right lines.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I’ve developed a windows service developed in Visual Studio 2010 which performs Exchange 2007
I have test this code on my development environment (windows 7, visual studio 2010)
Environment : Visual Studio 2010 v10.0.31118.1 SP1, Addins : jetBrain,DXCore,VisualSVN Windows 7 (up to
Environment: Visual Studio Ultimate 2010 Windows XP WPF Desktop Application using .NET 4.0 We
My development machine is running Windows 7 Ultimate x64. I installed Visual Studio 2010
Environment: Windows 7 SP1 Visual Studio 2010 Ultimate SP1 .NET 4.0 I have a
Environment: Visual Studio Ultimate 2010 .NET 4.0 Windows XP, Vista and 7 We have
My environment consists of Visual Studio 2010 and Windows 7 a few months ago
Something, maybe the windows sdk or visual studio installer, has defined the Platform environment
I would like to do some C development in Windows environment using Visual Studio

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.