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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T09:45:01+00:00 2026-05-11T09:45:01+00:00

We have a WCF (.NET 3.5 SP1) service running in IIS7, which is marked

  • 0

We have a WCF (.NET 3.5 SP1) service running in IIS7, which is marked to allow ASP.NET compatibility mode so we can access HttpContext.Current:

[AspNetCompatibilityRequirements(     RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] 

However, when trying to access any server variable it throws an ArgumentException:

System.ArgumentException: Value does not fall within the expected range.      at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)      at System.Web.Hosting.IIS7WorkerRequest.GetServerVariableInternal(String name)      at System.Web.Hosting.IIS7WorkerRequest.GetServerVariable(String name)      at System.Web.Hosting.IIS7WorkerRequest.GetRemoteAddress()      at System.Web.HttpRequest.get_UserHostAddress()  

e.g. Any of the following lines throw this exception:

ha = HttpContext.Current.Request.UserHostAddress; ip = HttpContext.Current.Request.ServerVariables['HTTP_X_FORWARDED_FOR']; us = HttpContext.Current.Request.UserAgent; 

This appears to be the result of an internal framework call, which means the calling code is not at fault.

Presumably there is something in our configuration that is causing this problem, but I don’t know what. Any ideas? Or any ideas how else I can retrieve these three bits of data (they don’t appear to be exposed by WCF natively, unfortunately).

  • 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. 2026-05-11T09:45:02+00:00Added an answer on May 11, 2026 at 9:45 am

    Turns out the problem is that the operation is marked with…

    [OperationContract(IsOneWay = true)] 

    …and that server variables aren’t available in one-way operations.

    Shame the exception doesn’t say something to that effect…

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

Sidebar

Related Questions

We have a ASP.NET application running and i have added a WCF Rest service
I have a WCF application, running on .NET 3.5 SP1, hosted in IIS7, on
I have a .NET WCF web service running on a server that I access
I have a .Net 3.5 SP1 WCF service running under IIS 7 on a
I have a WCF service that I need to call in a ASP.NET web
I have an ASP.NET application which talks to a third-party SOAP web service. My
I have a .NET WCF service which is implemented in a hand full of
I have a RESTful WCF service (.NET 3.5), which has a function that is
I have a wcf service in .net, which i want to return a named
As i've mentioned in topic. I have WCF Rest Service, and ASP.NET MVC3 client.

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.