2
votes

As I am getting Problem while hosting WCF Service on Win 2003 Server. As it is working fine in my local PC.

Please let me now if I need to do any changes in Web Config. File. for the same.

Server Error in '/' Application. IIS specified authentication schemes 'IntegratedWindowsAuthentication, Anonymous', but the binding only supports specification of exactly one authentication scheme. Valid authentication schemes are Digest, Negotiate, NTLM, Basic, or Anonymous. Change the IIS settings so that only a single authentication scheme is used. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: IIS specified authentication schemes 'IntegratedWindowsAuthentication, Anonymous', but the binding only supports specification of exactly one authentication scheme. Valid authentication schemes are Digest, Negotiate, NTLM, Basic, or Anonymous. Change the IIS settings so that only a single authentication scheme is used.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[InvalidOperationException: IIS specified authentication schemes 'IntegratedWindowsAuthentication, Anonymous', but the binding only supports specification of exactly one authentication scheme. Valid authentication schemes are Digest, Negotiate, NTLM, Basic, or Anonymous. Change the IIS settings so that only a single authentication scheme is used.]
   System.ServiceModel.Web.WebServiceHost.SetBindingCredentialBasedOnHostedEnvironment(ServiceEndpoint serviceEndpoint, AuthenticationSchemes supportedSchemes) +446264
   System.ServiceModel.Web.WebServiceHost.AddAutomaticWebHttpBindingEndpoints(ServiceHost host, IDictionary`2 implementedContracts, String multipleContractsErrorMessage) +709
   System.ServiceModel.Web.WebServiceHost.OnOpening() +203
   Microsoft.ServiceModel.Web.WebServiceHost2.OnOpening() in e:\bt\3781\Microsoft.ServiceModel.Web\Microsoft.ServiceModel.Web\WebServiceHost2.cs:69
   System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) +229
   System.ServiceModel.HostingManager.ActivateService(String normalizedVirtualPath) +121
   System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) +479

[ServiceActivationException: The service '/Service.svc' cannot be activated due to an exception during compilation.  The exception message is: IIS specified authentication schemes 'IntegratedWindowsAuthentication, Anonymous', but the binding only supports specification of exactly one authentication scheme. Valid authentication schemes are Digest, Negotiate, NTLM, Basic, or Anonymous. Change the IIS settings so that only a single authentication scheme is used..]
   System.ServiceModel.AsyncResult.End(IAsyncResult result) +11599786
   System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +194
   System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(HttpApplication context, Boolean flowContext) +176
   System.ServiceModel.Activation.HttpModule.ProcessRequest(Object sender, EventArgs e) +278
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +68
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75


Version Information: Microsoft .NET Framework Version:2.0.50727.3615; ASP.NET Version:2.0.50727.3618 
1
check the binding configuration in web.config are you using basichttp or wshttp binding.?Aravind

1 Answers

3
votes

There's a quick fix, and a correct fix.

Quick Fix:

In IIS, go to the properties of the web application the service is running under, go to the "Directory Security" tab, and in the "Authentication and access control" group, press "Edit...". Remove whichever authentication scheme you do not require. Ok out of all dialogues, and then perform an IIS Reset.

Correct Fix:

Ensure that your service is configured to use an explicit endpoint. I've found that using the out of the box binding of webHttpBinding, and configuring the endpoint to use the webHttp behaviour was the trick.

If you don't specify an endpoint, the WebserviceHost will try and guess what you want, and invariably pick the wrong one.

In your web.config, you should have something like:

<system.serviceModel>
  <services>
    <service behaviourConfiguration="MyRestService.Behavior" 
             name="MyRestService>
      <endpoint address="" binding="webHttpBinding" contract="IMyRestService"
                behaviourConfiguration="MyRestService.WebHttpEndpointBehavior" />
    </service>
  </services>
  <bindings>
  </bindings>
  <behaviours>
    <serviceBehaviors>
      <behavior name="MyRestService.Behavior">
        <!-- Any configuration for the service, i.e. serviceDebug, etc. -->
      </behavior>
    </serviceBehaviors>
    <endpointBehaviors>
      <behavior name="MyRestService.WebHttpEndpointBehavior">
        <webHttp />
      </behavior>
    </endpointBehaviors>
  </behaviours>
</system.serviceModel>

Certainly having my configuration set-up like that has enabled me to run a WCF REST service on Win2k3 server with .NET 3.5 SP1 installed.