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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:35:50+00:00 2026-06-06T16:35:50+00:00

We have a ASP.NET application running and i have added a WCF Rest service

  • 0

We have a ASP.NET application running and i have added a WCF Rest service to it. Locally and when deployed on test environments this works fine. The issue is when we deploy to our production environment, which is only HTTPS.

I have searched and read most of the answers online and have tried so many things. All with no luck.

Here is our simple code

[ServiceContract]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class ReportingService
{
    public ReportingService()
    {
        Thread.CurrentPrincipal = HttpContext.Current.User;
    }

    [OperationContract]
    [WebGet(UriTemplate = "get/{id}", ResponseFormat = WebMessageFormat.Json)]
    [PrincipalPermission(SecurityAction.Demand)]
    public List<RawReportTable> GetReport(string id)
    {
        ...
    }
}

In Global.asax.cs we have

RouteTable.Routes.Add(new ServiceRoute("api/reporting", new WebServiceHostFactory(), typeof(ReportingService)));

In our web.config we have the following defined for system.serviceModel

<standardEndpoints>
  <webHttpEndpoint>
    <standardEndpoint name="api" helpEnabled="true" automaticFormatSelectionEnabled="true" maxBufferSize="500000" maxReceivedMessageSize="500000">          
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
      <security mode="Transport" />
    </standardEndpoint>
  </webHttpEndpoint>
</standardEndpoints>

<behaviors>
  <endpointBehaviors>
    <behavior name="api">
      <webHttp />
    </behavior>
  </endpointBehaviors>

  <serviceBehaviors>
    <behavior name="">
      <serviceCredentials>
          <serviceCertificate storeLocation="LocalMachine" storeName="My" x509FindType="FindByThumbprint" findValue="d5 85 5b 37 89 47 6f 89 71 5b b7 5d 87 6f 2e e5 24 aa 57 b6" />
      </serviceCredentials>
    </behavior>
  </serviceBehaviors>
</behaviors>

<services>
  <service name="ReportingService">
    <endpoint address="api/reporting" behaviorConfiguration="api" binding="webHttpBinding" bindingConfiguration="webBinding" contract="WayfinderFM.Service.api.ReportingService" />
  </service>
</services>

<bindings>
  <webHttpBinding>
    <binding name="webBinding">
      <security mode="Transport" />
    </binding>
  </webHttpBinding>
</bindings>

With this set up I get the following errors:
Request Error: The server encountered an error processing the request. See server logs for more details.

I thought (and some example show) that I no longer need the services/endpoint stuff in the configuration as it is registered in the routing.

Removing that part we still get the same error. I have tried lots of different configurations, all with no luck.

The weird thing is /api/reporting/help actually shows. Just can’t use any of the services.

Anybody have any idea? I’m hoping it is something simple I have missed.

Thanks all

Edit

I believe it is to do with the
[PrincipalPermission(SecurityAction.Demand)]
We use this to make sure the user is authenticated and we can access the token. I’ve found PrincipalPermission.Demand() failing once WCF Service was moved to SSL which sadly doesn’t have an answer to it.

  • 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-06T16:35:51+00:00Added an answer on June 6, 2026 at 4:35 pm

    Hate to answer my own question, but after reading Rajesh’s message I looked into the error more. As my edit says it was related to the PrincipalPermission attribute. If I removed that it was running my code and failing in my authentication.

    So back to searching the internet and I found http://forums.silverlight.net/t/34954.aspx/1

    I just added to the serviceBehaviours. So it looks like

    <serviceBehaviors>
        <behavior name="">
            <serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true" />
            <serviceAuthorization principalPermissionMode="None"/>
        </behavior>
    </serviceBehaviors>
    

    Now it works, I can call my services and get rejected unless I am authenticated etc. Yay

    Hopefully this helps someone else with this issue

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

Sidebar

Related Questions

I have added a service reference to my asp.net web application (originally it was
I have deployed an ASP.NET web application to Azure running in a web role.
I have an ASP.NET application running on multiple IIS6 web servers, with a SQL
I have an Asp.net MVC application running on AppHarbor. It has the everyday email
I have an ASP.NET 2.0 web application running on a shared server of a
We have a asp.net 2.0 web application that is running on IIS7. It is
I have migrated one ASP.NET v4.0 application to a new server running under a
I have a small web application with ASP.NET AJAX running well under the Cassini
My situation is this: I have an ASP.NET web application that I want to
I have an Asp.Net MVC 2 web application deployed on IIS 7.5 on .Net

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.