WCF service with Factory attribute on .svc is not working on web server (IIS6), but is locally using IIS7

iis-6iis-7wcf

I am working on implementing a non web.config approach of WCF services using the factory attribute on the .svc file per Rick Strahl's blog post:

Factory="System.ServiceModel.Activation.WebScriptServiceHostFactory"

Locally, I am running IIS7 in Visual Studio 2008 and have no problem, but when I deploy to my web server (currently running IIS6), I am getting an authentication error in the event log:

Exception:
System.ServiceModel.ServiceActivationException:
The service
'/Services/ResourcesService.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.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.
at
System.ServiceModel.Web.WebServiceHost.SetBindingCredentialBasedOnHostedEnvironment(ServiceEndpoint
serviceEndpoint, AuthenticationSchemes
supportedSchemes) at
System.ServiceModel.Web.WebServiceHost.AddAutomaticWebHttpBindingEndpoints(ServiceHost
host, IDictionary`2
implementedContracts, String
multipleContractsErrorMessage) at
System.ServiceModel.WebScriptServiceHost.OnOpening()
at
System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan
timeout) at
System.ServiceModel.Channels.CommunicationObject.Open()
at
System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(String
normalizedVirtualPath) at
System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String
normalizedVirtualPath)

After doing some Googling, I changed my authentication settings on the .svc folder within my project (on the server) to only anonymous authentication, but it did not work. I still get web service failed on the calls. IIS7 by default only had anonymous.

I do not have any entries in my web.config for the services (I stripped them out per this pattern).

I am using a nant script to deploy the website to the server and use this also locally to verify the script was not causing the issue.

Any known issue with this? IIS 6 not able to handle?

Best Answer

I got this error ...

Checked my web site properties in IIS Manager and found both Anonymous and Integrated Windows Authentication were ticked, so un-ticked Integrated, but it still wouldn't work.

Eventually spotted a post that mentioned restarting IIS ... did that and things worked !!

Related Topic