Reputation: 238086
Using wsdl.exe /l:CS /serverInterface
, I generated a C# interface from a WDSL document. I've implemented that interface on a WCF class. The resulting service runs locally:
http://localhost:51454/TapasSim.svc
This shows the default site. The problem appears when I append ?wsdl
to the URL:
http://localhost:51454/TapasSim.svc?wsdl
Unlike what I expected, this link does not return a WDSL document! Instead, it points back to the exact web page you get without the ?wsdl
. As a result, I cannot reference the web service. If I run svcutil.exe
it gives this error:
If you were trying to generate a client, this could be because the metadata documents did not contain any valid contracts or services or because all contracts/services were discovered to exist in /reference assemblies. Verify that you passed all the metadata documents to the tool.
But I would expect that error to have the same cause as the lack of reply to ?wsdl
.
What could cause a WCF .svc
service not to generate WSDL?
Upvotes: 8
Views: 14690
Reputation: 391
I had a problem with getting the WSDL via the IE window provided by starting the debugging session. I had to use a separate window, ensuring I put the HTTPS in the URL.
We are hosting our services on 443 (SSL). When you start up the debugger, even though the IE windows shows http: (80), it was listening for traffic on 443.
FYI, this is controlled via the project level setting SSL Enabled
Upvotes: 0
Reputation: 238086
As it turns out, the problem was mixing two technologies. wdsl.exe
belongs to the older "Web References" that predate WCF. The newer tool svcutil.exe
is meant for generating WCF "Service Reference" interfaces.
So what happened was that WCF looked for [ServiceContract]
and [OperationContract]
attributes. When it couldn't find any, it silently did nothing.
The silent suppression of this condition is annoying, to say the least. An error like No service with [ServiceContract] attribute found
would really have helped.
Note that you can manually add [ServiceContract]
, but that will leave you with half "Service Reference" half "Web Reference". The result probably will not work.
Upvotes: 8