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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:34:13+00:00 2026-05-25T16:34:13+00:00

I have a WCF Service that is hosted in a ServiceHost object. The ServiceHost

  • 0

I have a WCF Service that is hosted in a ServiceHost object. The ServiceHost is created on the OnStart method of an Azure Worker Role. Here is the code:

        ServiceBusEnvironment.SystemConnectivity.Mode = ConnectivityMode.Http;

        Uri baseAddress = ServiceBusEnvironment.CreateServiceUri("http", "my_sb", "SimpleService");

        host = new ServiceHost(typeof(SimpleService1.Service1), baseAddress);

        BasicHttpRelayBinding binding = new BasicHttpRelayBinding(EndToEndBasicHttpSecurityMode.None, RelayClientAuthenticationType.None);
        binding.OpenTimeout = new TimeSpan(1, 1, 0);
        binding.ReceiveTimeout = new TimeSpan(1, 10, 0);
        binding.SendTimeout = new TimeSpan(1, 10, 0);
        binding.MaxReceivedMessageSize = 73400320;
        XmlDictionaryReaderQuotas readerQuotas = new XmlDictionaryReaderQuotas();
        readerQuotas.MaxArrayLength = 73400320;
        binding.ReaderQuotas = readerQuotas;

        TransportClientEndpointBehavior sharedSecretServiceBusCredential = new TransportClientEndpointBehavior();
        sharedSecretServiceBusCredential.CredentialType = TransportClientCredentialType.SharedSecret;

        sharedSecretServiceBusCredential.Credentials.SharedSecret.IssuerName = "owner";
        sharedSecretServiceBusCredential.Credentials.SharedSecret.IssuerSecret = "blablablabla==";


        ContractDescription contractDescription = ContractDescription.GetContract(typeof(SimpleService1.IService1), typeof(SimpleService1.Service1));
        ServiceEndpoint serviceEndPoint = new ServiceEndpoint(contractDescription);
        serviceEndPoint.Address = new EndpointAddress(baseAddress);
        serviceEndPoint.Binding = binding;

        IEndpointBehavior serviceRegistrySettings = new ServiceRegistrySettings(DiscoveryType.Public);

        serviceEndPoint.Behaviors.Add(serviceRegistrySettings);
        serviceEndPoint.Behaviors.Add(sharedSecretServiceBusCredential);


        host.Description.Endpoints.Add(serviceEndPoint);

        try
        {

            host.Open();

        }

        catch (Exception ex)
        {

            Trace.WriteLine(ex.Message, "Error");

            throw;

        }

        Trace.WriteLine("SimpleService1 running...");

and the binding configuration on the client side is:

        <basicHttpBinding>
          <binding name="FileTransferBinding" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" maxReceivedMessageSize="73400320">
            <readerQuotas maxArrayLength="73400320"/>
            <security mode="None"/>
          </binding>
        </basicHttpBinding>

and

<endpoint address="http://my_sb.servicebus.windows.net/simpleservice" binding="basicHttpBinding" bindingConfiguration="FileTransferBinding" contract="Service1reference.IService1" name="FileTransferBinding" behaviorConfiguration="sbBehavior"/>

The problem is that if one call to the service takes longer than 1 minute, the client receives this exception:

The content type application/xml; charset=utf-8 of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly

If I change the binding to a netTcpRelayBinding everything works fine.

  • 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-25T16:34:14+00:00Added an answer on May 25, 2026 at 4:34 pm

    This is because the Windows Azure load-balancer disconnects you if the connection is idle for more than a minute.

    Your best bet is to use a WCF callback. This will execute a call from the server to the client to let it know that the long-running operation has completed. For more on how to do this have a look at this blog [WCF Callbacks

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

Sidebar

Related Questions

I have a piece of code that calls a WCF service that is hosted
We have created a WCF service hosted in a windows service that handles Authentication
here's the setup for the project. I have a WCF Service that is hosted
I have a WCF service that is hosted in a windows application. The service
I have an wcf service that is hosted in II6. The service uses the
I have a wcf service library that is hosted in a windows service. I
I have a C# WCF service DLL that gets hosted by WcfSvcHost.exe when I
I have a WCF service, hosted in IIS 7.0 that needs to run database
I have a WCF Service that exposes a method GetCustomers(). The internals of the
I have WCF service that is hosted in IIS . I need to initialize

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.