Grrr... Just wasted lots of time on a stupid mistake due to misleading error message. I hate it when that happens.
I usually do self-hosting for my WCF services, but on a project I am working on we wanted to host in IIS. I was focused on the security aspects - trying to get Integrated Windows security on a web site, using impersonation to call the service under the client's credentials, protecting the service with Integrated Windows Authentication and turning off anonymous access in IIS.
I was trying different bindings and settings in IIS and at some point I could no longer get client proxy generation to work on my service through svcutil or by making a service reference. When running svcutil I kept getting the following error:
svcutil.exe http://localhost/BowneService/PricingS
ervice.svc
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.30]
Copyright (c) Microsoft Corporation. All rights reserved.
Attempting to download metadata from 'http://localhost/BowneService/PricingServi
ce.svc' using WS-Metadata Exchange or DISCO.
Error: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.Se
rviceModel.Description.DataContractSerializerMessageContractImporter
Error: Schema with target namespace 'http://tempuri.org/' could not be found.
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/'
]/wsdl:portType[@name='IPricing']
Error: Cannot import wsdl:binding
Detail: There was an error importing a wsdl:portType that the wsdl:binding is de
pendent on.
XPath to wsdl:portType: //wsdl:definitions[@targetNamespace='http://tempuri.org/
']/wsdl:portType[@name='IPricing']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/'
]/wsdl:binding[@name='PricingwsHttpEndpoint']
Error: Cannot import wsdl:port
Detail: There was an error importing a wsdl:binding that the wsdl:port is depend
ent on.
XPath to wsdl:binding: //wsdl:definitions[@targetNamespace='http://tempuri.org/'
]/wsdl:binding[@name='PricingwsHttpEndpoint']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/'
]/wsdl:service[@name='Pricing']/wsdl:port[@name='PricingwsHttpEndpoint']
Generating files...
Warning: No code was generated.
If you were trying to generate a client, this could be because the metadata docu
ments did not contain any valid contracts or services
or because all contracts/services were discovered to exist in /reference assembl
ies. Verify that you passed all the metadata documents to the tool.
Warning: If you would like to generate data contracts from schemas make sure to
use the /dataContractOnly option.
It turns out, somewhere in the process of trying to get things to work, I changed the account the AppPool was running under from "Network Service" to a service account I'd created. That service account didn't have write permissions to the C:\Windows\Temp directory, so it couldn't do the code generation necessary to generate the datacontract schemas. Here is the blog entry I found that clued me in:
http://blogs.infosupport.com/raimondb/archive/2008/02/14/Unable-to-generate-a-WCF-proxy-using-svcutil-but-retreiving-the-wsdl-works_3F00_.aspx
I am mostly posting so others find it quicker in the search engine.
The other lesson is the classic TDD mantra: make changes one at a time and test between every step. You might go a little slower, but you move along much more predictably because when something breaks, you know what it was.