tags:

views:

14

answers:

1

Hi

I'm getting the following error when trying to connect to a WCF web service:

WCF web query ... Unhandled Exception: System.ServiceModel.Security.SecurityNegotiationException: The caller was not authenticated by the service. ---> System.ServiceModel.FaultException: The request for security token could not be satisfied because authentication failed. at System.ServiceModel.Security.SecurityUtils.ThrowIfNegotiationFault(Message message, EndpointAddress target) at System.ServiceModel.Security.SspiNegotiationTokenProvider.GetNextOutgoingM essageBody(Message incomingMessage, SspiNegotiationTokenProviderState sspiState)

I've written both the WCF client and the server apps in C#. The client talks to the server nicely when its running locally, but falls over with a certificate request error when I make the same call to the remote server copied to remote Amazon EC2 cloud computer.

How do I temporarily switch off certificate requests in WCF, just so I can see if everything is working properly?

A: 

Got it! Switched off security. I can now talk to the remote WCF service, it all works perfectly.

The key is to run the WCF Configuration tool to change the transport layer to basicHTTP binding, and make sure security is turned off by default. Here's the steps.

  1. Run "Edit WCF Configuration" by right clicking on App.Config.
  2. Create a new binding with no security. Under "Bindings" select "New Binding Configuration". I selected "basicHTTPbinding", which by default has no security. I named this binding profile "nosecurity".
  3. Configure the endpoint to use this "nosecurity" binding. Under the "Service Endpoint" for the transport layer (not the the mex - this is for service discovery), select "basicHTTPbinding" as the "Binding", and under "Binding configuration", select the "nosecurity" profile.
  4. Everything now works perfectly, with no certificate errors.

Here is the completed App.config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="nosecurity" />
            </basicHttpBinding>
        </bindings>
        <services>
            <service behaviorConfiguration="PhiFeedServiceBehavior" name="NeuralFutures.Datafeed.PhiFeed">
                <endpoint address="" binding="basicHttpBinding" bindingConfiguration="nosecurity"
                    contract="NF.Datafeed.IPhiFeed" />
                <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
                <host>
                    <baseAddresses>
                        <add baseAddress="http://localhost:31415/PhiFeed" />
                    </baseAddresses>
                </host>
            </service>
        </services>
        <behaviors>
            <serviceBehaviors>
                <behavior name="PhiFeedServiceBehavior">
                    <serviceMetadata httpGetEnabled="true"/>
                    <serviceDebug includeExceptionDetailInFaults="False"/>
                </behavior>
            </serviceBehaviors>
        </behaviors>
    </system.serviceModel>
</configuration>  
Gravitas

related questions