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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:56:00+00:00 2026-05-27T06:56:00+00:00

I have a WCF REST-service that is used by a mobile application used in

  • 0

I have a WCF REST-service that is used by a mobile application used in different countries. It’s accepting and returning JSON, and I use StructureMap.

The idea is to create one service instance for all countries, but I need to know what country is calling the service and do some logic on that in the service (for example, determine the connection string to be used).

however, I want to avoid that country code has to be passed with each service request. What are my options here?

Can I, for example, have one endpoint for each country? But in that case, how can I know what endpoint/country code was used to call the service?

Maybe other possibilities?

  • 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-27T06:56:01+00:00Added an answer on May 27, 2026 at 6:56 am

    Multiple endpoints could be a solution, but you need a reliant way of determining which endpoint was actually used. Given the “disconnected” nature of WCF REST services (by that I mean the usage of non WCF types to do the communication and just using the WCF attributes), this would require you to write a WebHostFactory that specifies the country on creation of the service for a given endpoint. What you could to is inspect the WebOperationCurrent.Current instance to get access to information hidden from your method signature. For example:

    Uri requestRoot = WebOperationContext.Current.IncomingRequest.UriTemplateMatch.BaseUri;
    if (requestRoot.PathAndQuery.Contains("en-us")) {
        // use english locale
    }
    else if (requestRoot.PathAndQuery.Contains("de-de")) {
        // use german locale
    }
    

    You would need a better strategy to determine the actual country/language, but the basic idea is to re-host the same service under multiple paths and inspect those paths within the request using the current WebOperationContext instance.

    Edit
    From the comments above, I would like to add that you have access to the UserAgent string for the current request using the WebOperationContext. So you could also inspect those information looking for a clue about the requested language. But keep in mind that those “implicit” information are only clues but never clear indications about what the user wants.

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

Sidebar

Related Questions

I have an asp.net 4 application that hosts a WCF REST service via WebServiceHost...
I have ASP MVC 3 application. I created WCF REST JSON Service and added
I have a WCF rest service using webHttpBinding that returns JSON result. The problem
I have created a WCF REST service that returns JSON, but the properties in
I have a C# REST Service in WCF that sits on top of an
We have a ASP.NET application running and i have added a WCF Rest service
I have a WCF REST Service which accepts a JSON string One of the
I've written a windows service application that exposes a WCF REST web service. The
I have a WCF REST web service that is hosted via a service route
I have built a WCF REST web service (WCF Service Application) and when 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.