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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:20:49+00:00 2026-06-02T16:20:49+00:00

I am hosting WCF as Windows Service using net.tcp. After installing the windows service

  • 0

I am hosting WCF as Windows Service using net.tcp. After installing the windows service when I start the service, I get that service was started and stopped.

The error says in order to In order to add an endpoint to the service ‘MYService’, a non-empty contract name must be specified.
at System.ServiceModel.Description.ConfigLoader.LookupContract(String contractName, String serviceName)

My OnStart function is as follows

 protected override void OnStart(string[] args)
        {
            try
            {
                if (myServiceHost != null)
                {
                    myServiceHost.Close();
                }
                myServiceHost = new ServiceHost(typeof(MYservice));
                myServiceHost.Open();

            }
            catch (Exception ex)
            {
                log.Error("ONStart", ex);
                throw;
            }

        }

The config file is as follows:

<serviceHostingEnvironment minFreeMemoryPercentageToActivateService="10" />
<services>
  <service behaviorConfiguration="myServiceBehavior"
    name="myNamespace.myTestService">
    <endpoint binding="netTcpBinding" bindingConfiguration="netTCPBindingConfig" contract="myNamespace.ServiceInterface.ImyTestService" />
    <endpoint binding="mexTcpBinding" bindingConfiguration="" />
    <host>
      <baseAddresses>
        <add baseAddress="net.tcp://10.1.3.69:8523/TestService" />
      </baseAddresses>
      <timeouts closeTimeout="10:00:10" openTimeout="10:01:00" />
    </host>
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="myServiceBehavior">
      <serviceMetadata httpGetEnabled="false" httpsGetEnabled="false" />
      <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
  </serviceBehaviors>
</behaviors>

  • 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-02T16:20:49+00:00Added an answer on June 2, 2026 at 4:20 pm

    In your config file, there is:

    <endpoint binding="netTcpBinding" bindingConfiguration="netTCPBindingConfig" contract="myNamespace.ServiceInterface.ISomeService" /> `
    

    Instead of ISomeService, you must specify whichever interface is implemented by MYService.

    EDIT

    Additionally, mex binding must have a contract specified, i.e. contract="IMetadataExchange"

    EDIT AGAIN

    For your convenience, this is how your mex binding should look like:

    <endpoint binding="mexTcpBinding" address="mex" bindingConfiguration="" contract="IMetadataExchange" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When trying to host my WCF service using Net Tcp channel through Windows Console,
when i install wcf service hosting on windows service using InstallUtil i get the
I have six wcf services that I'm hosting in a windows service. Everything works
Background: We are hosting a .NET 4.0 Windows Workflow activity inside a WCF service
I have a WCF service running on a net.tcp port inside a hosting application
It is possible to have WCF Client that connects persistantly using duplex over net.tcp
I am using a wcf service that I created, when both hosting machine and
I am hosting a WCF service in a Windows Service on one of our
I host my WCF Service with windows service hosting... now when I call my
I have a WCF service and am hosting it in a Windows Service. I

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.