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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T11:44:45+00:00 2026-05-19T11:44:45+00:00

I have developed a wcf service having two contracts Contract1 and Contract2 exposed on

  • 0

I have developed a wcf service having two contracts Contract1 and Contract2 exposed on two different endpoints.
When i am going to add reference to my client application it allows me to consume both contracts.

How i restrict client application to consume only one contract?

here is my web.config’s code

<system.serviceModel>
    <services>
        <service behaviorConfiguration="MyWCFService.Service1Behavior"
         name="MyWCFService.Service1">
            <host>
                <baseAddresses>
                    <add baseAddress="http://localhost:1010/Service1.svc"/>
                </baseAddresses>
            </host>

            <endpoint address="/MyService1" binding="wsHttpBinding" contract="MyWCFService.IService1" />                
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
            <endpoint address="/MyService2" binding="wsHttpBinding" contract="MyWCFService.IService2" />

        </service>
    </services>
    <behaviors>
        <serviceBehaviors>
            <behavior name="MyWCFService.Service1Behavior">
                <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
                <serviceMetadata httpGetEnabled="true"/>
                <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
                <serviceDebug includeExceptionDetailInFaults="false"/>
            </behavior>
        </serviceBehaviors>
    </behaviors>
</system.serviceModel>

Thanks in advance.

  • 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-19T11:44:46+00:00Added an answer on May 19, 2026 at 11:44 am

    why not break single webservice endpoint with 2 contracts into two webservice endpoints on different addresses and 1 contract per each and use only one in your client application.

    Its unclear why your design requires 2 contracts on 1 endpoint , only allowing client to use 1 contract.

    Or add some security, maybe some fairly basic stuff like add password field to method signatures in contract you want to restrain access to.

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

Sidebar

Related Questions

I have a WCF service which has two methods exposed: Note: The wcf service
I am having this strange problem: I have just developed a WCF service (on
I have developed a Web service using WCF Service Application. This service application is
I have developed a sample WCF REST service that accepts that creates an Order
I've recently developed a WCF Facade service. I'm new to WCF and having trouble
I have developed a WCF service (framework 4.0) which should communicate with a client
I have developed a small WCF service which handles HTTP request. I want to
I am new to WCF. I have developed a sample WCF service. My service
I have a simple WCF web service on my machine which I have developed
I have developed a WCF Service Application hosted in IIS 7.5 targeting .NET 3.5

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.