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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T18:33:34+00:00 2026-05-21T18:33:34+00:00

FooService.svc.cs: [ServiceContract(ProtectionLevel = ProtectionLevel.EncryptAndSign)] public interface IFooBar { [OperationContract()] int Add(int num1, int num2);

  • 0

FooService.svc.cs:

[ServiceContract(ProtectionLevel = ProtectionLevel.EncryptAndSign)]
public interface IFooBar
{
    [OperationContract()]
    int Add(int num1, int num2);
}

[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple)]
public class FooService : IFooBar
{
    public int Add(int num1, int num2)
    {
        return num1 + num2;
    }
}

Web.config:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>

  <system.web>
    <customErrors mode="Off"/>
    <globalization culture="en-US" uiCulture="en-US" />
    <compilation defaultLanguage="c#" targetFramework="4.0" />
  </system.web>

  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>

  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
        <defaultDocument>
            <files>
                <add value="index.aspx" />
            </files>
        </defaultDocument>
  </system.webServer>

  <system.diagnostics>
    <sources>
      <source name="System.ServiceModel.MessageLogging" switchValue="Warning, ActivityTracing">
        <listeners>
          <add name="ServiceModelTraceListener" />
        </listeners>
      </source>

      <source name="System.ServiceModel" switchValue="Verbose,ActivityTracing">
        <listeners>
          <add name="ServiceModelTraceListener" />
        </listeners>
      </source>
      <source name="System.Runtime.Serialization" switchValue="Verbose,ActivityTracing">
        <listeners>
          <add name="ServiceModelTraceListener" />
        </listeners>
      </source>
    </sources>
    <sharedListeners>
      <add initializeData="App_tracelog.svclog" type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="ServiceModelTraceListener" traceOutputOptions="Timestamp" />
    </sharedListeners>
  </system.diagnostics>

</configuration>

I published the Files to my server (which has a ssl certificate on it), but when I go to the webpage: https://localhost:443/FooService.svc I get the following error…

The request message must be protected.
This is required by an operation of
the contract
(‘IFooBar’,’http://tempuri.org/&#8217;). The
protection must be provided by the
binding
(‘BasicHttpBinding’,’http://tempuri.org/&#8217;).

This happens whether I go to the url directly or if I go to Add Service Reference... from within Visual Studio.


Also, if I change the [ServiceContract(ProtectionLevel = ProtectionLevel.EncryptAndSign)] to [ServiceContract] it works fine.

  • 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-21T18:33:35+00:00Added an answer on May 21, 2026 at 6:33 pm

    The default binding for the HTTP transport in WCF 4 is basicHttpBinding. When you set the service contract protection level to encrypt and sign then the binding must also support message level security. Since basicHttpBinding does not support message level security, you need to configure the service manually to wsHttpBinding or change the protocol map as follows:

    <system.serviceModel>
       <protocolMapping>
          <remove scheme="http" />
          <add scheme="http" binding="wsHttpBinding" bindingConfiguration="" />
       </protocolMapping>
    ... snip ...
    </system.serviceModel>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

FooService.cs : public interface IFooService { int Foo(); } [Export(Foo1, typeof(IFooService))] public class Foo1
The question from the title in code: @Transactional (readonly = true) public interface FooService
Assuming that I have the following interface and class: public interface IFooRepo : IDisposable
What is the best way to unit test/integration test the following : @Service(fooService) public
Let's say I have a service interface that looks like this: public interface IFooService
I have a WCF web service project, say FooService.vbproj with a FooService.svc endpoint. Its
@Service @Order(1) public class FooService implements IService {..} @Service @Order(2) public class BarService implements
Suppose I have an interface for a service: public interface IFooService { void DoSomething();
My code is like this : NSString *urlStr = [NSString stringWithFormat:@https://xxx.xxx.xx.xx/Pages/Service/FMService.svc/FileAudit?user=%@&pass=%@&fileId=%d&isAudited=1&opinion=%@,appDelegate.user.userName,appDelegate.user.password,self.todo.fileId,self.opinion]; NSLog(@URL=%@,urlStr); NSURL *url
I just add gcal to my project according to this tutorial http://www.youtube.com/watch?v=it_9H0GxRNI but 12

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.