tags:

views:

1014

answers:

3

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?

A: 

The major difference between IIS 6 and IIS 7 with respect to WCF is the bindings that they support. For example IIS 6 supports basichttpbinding but not nettcpbinding.

The other thing to watch out for is if IIS 6 is configured to serve .svc files, that minimum .net framework 3.0 is installed.

Shiraz Bhaiji
The website is using 3.5 framework, which is installed locally and on the web server respectively. The confusing part -- the services are fine on the web server if I have the web.config entries and no factory attribute on the .svc file.
Jessica
A: 

Jessica, did you ever get this working? I'm trying the same example, and am having exactly the same problem. I'm running IIS 5.1, but, like you, if I use the web.config settings, everything is fine. Did you have any luck finding out what the problem is? Thanks!

Ramble Campbell
A: 

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 !!

SteveC