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 8969913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:39:38+00:00 2026-06-15T17:39:38+00:00

I am trying to create a WCF service at runtime. My service interface is:

  • 0

I am trying to create a WCF service at runtime. My service interface is:

[ServiceContract]
public interface IInformationService : IService
{
    [OperationContract]
    [WebInvoke(Method = "Get", ResponseFormat = WebMessageFormat.Json, 
     UriTemplate = "Test",     RequestFormat  = WebMessageFormat.Json)]
    string Test();
}

I am serving my service as follows:

var httpEnumerator = ImplementedContracts.Values.GetEnumerator();
httpEnumerator.MoveNext();

var httpContractType = httpEnumerator.Current.ContractType;
var webBinding = new WebHttpBinding()
                 {
                   Security =
                   {
                     Mode = WebHttpSecurityMode.None
                   }
                 };

var httpEndpoint = AddServiceEndpoint(
  httpContractType, 
  webBinding, baseAddress+/Get"
);

httpEndpoint.Behaviors.Add(new CustomEndpointBehavior());

The ServiceHost is created by this method:

protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses)
{
  var host = new WcfServiceHost(serviceType, baseAddresses);

  if (host.Description.Behaviors.Contains(typeof(ServiceDebugBehavior)))
  {
    (host.Description.Behaviors[typeof(ServiceDebugBehavior)] as 
    ServiceDebugBehavior).IncludeExceptionDetailInFaults = true;
  }
  else
  {
    var debug = new ServiceDebugBehavior
                {
                  IncludeExceptionDetailInFaults = true
                };

    host.Description.Behaviors.Add(debug);
  }

  if (host.Description.Behaviors.Contains(typeof(ServiceMetadataBehavior)))
  {
    (host.Description.Behaviors[typeof(ServiceMetadataBehavior)] as ServiceMetadataBehavior).HttpGetEnabled = true;
    (host.Description.Behaviors[typeof(ServiceMetadataBehavior)] as ServiceMetadataBehavior).HttpsGetEnabled = true;
  }
  else
  {
    var smb = new ServiceMetadataBehavior
              {
                HttpGetEnabled = true,
                HttpsGetEnabled = true
              };

    host.Description.Behaviors.Add(smb);
  }

  host.AddServiceEndpoint(
    ServiceMetadataBehavior.MexContractName,
    MetadataExchangeBindings.CreateMexHttpsBinding(),
    "mex"
  );

  host.AddServiceEndpoint(
    ServiceMetadataBehavior.MexContractName,
    MetadataExchangeBindings.CreateMexHttpBinding(),
    "mex"
  );

  return host;
}

Service route creation:

var serviceRoute = new ServiceRoute(
  "wcf.service/" + service.Value.Name, 
  new WcfServiceHostFactory(), 
  service.Value
);

if (!RouteTable.Routes.Contains(serviceRoute))
{
    RouteTable.Routes.Add(serviceRoute);
}

When I try to access my service from a web browser using the address

http://localhost/Werp.View/wcf.service/InformationService/Get/Test

I obtain the following error:

<Fault xmlns="http://schemas.microsoft.com/ws/2005/05/envelope/none">
  <Code>
    <Value>Sender</Value>
    <Subcode>
      <Value xmlns:a="http://schemas.microsoft.com/ws/2005/05/addressing/none">
         a:ActionNotSupported
      </Value>
    </Subcode>
  </Code>

<Reason>
  <Text xml:lang="en-US">
    The message with Action '' cannot be processed at the receiver, due to a 
    ContractFilter mismatch at the EndpointDispatcher. This may be because of 
    either a contract mismatch (mismatched Actions between sender and receiver) 
    or a binding/security mismatch between the  sender and the receiver. Check 
    that sender and receiver have the same contract and the same  binding 
    (including security requirements, e.g. Message, Transport, None).
  </Text>
</Reason>

Can anyone help me?

  • 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-06-15T17:39:39+00:00Added an answer on June 15, 2026 at 5:39 pm

    My problem has been solved when I added WebHttpBehavior to endpoint

    httpEndpoint.Behaviors.Add(new WebHttpBehavior());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

am trying to create WCF client to consume the service, which contains messages. So
I'm trying to follow a guide from http://kellabyte.com/2010/11/13/building-extensible-wcf-service-interfaces-with-datacontractresolver/ to create and attach a DataContractSerializer.
I am trying to create a common service library shared between a WCF web
I am trying create a WCF service that leverages the WPF MediaPlayer on the
So I'm trying to create a C# WCF REST service that is called by
I am trying to create a WCF service that uses certificate authentication over SSL
I am trying to create a WCF service that supports asynchronous calls. I followed
I just started learning on WCF and is trying to create a WCF service
I am trying to create a report using a wcf service as a datasource.
We are trying to create a proxy class that would serve the WCF service

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.