I'm trying to use extenionless / .svc-less WCF services. Can anyone else confirm or deny the issue I'm experiencing?
I use routing in code, and do this in Application_Start of global.asax.cs:
RouteTable.Routes.Add(new ServiceRoute("Data", new WebServiceHostFactory(), typeof(DataDips)));
I have tested in both IIS 6 and IIS 7.5 and I can use the service just fine (ie my extensionless wildcard mapping handler config is correctly pointed at ASP.NET). However, metadata generation is totally screwed up. I can hit my /mex endpoint with the WCF Test Client (and I presume svcutil.exe) -- but the ?wsdl generation you typically get with .svc is toast. I can't hit it with a browser (get 400 bad request), I can't hit it with wsdl.exe, etc. Metadata generation is configured correctly in web.config.
This is a problem of course, because the service is exposed as basicHttpBinding so that an old style ASMX client can get to it. But of course, the client can't generate the proxy without a WSDL description.
If I instead use serviceActivation routing in config like this, rather than registering a route in code:
<serviceHostingEnvironment aspNetCompatibilityEnabled="true">
<serviceActivations>
<add relativeAddress="Data.svc" service="DataDips" />
</serviceActivations>
</serviceHostingEnvironment>
Then voila... it works.
But then I don't have a clean extensionless url. If I change relativeAddress from Data.svc to Data, then I get a configuration exception as this is not supported by config. (Must use an extension registered to WCF).
I've also attempted to use this code in conjunction with the above config:
RouteTable.Routes.MapPageRoute("","Data/{*data}","~/Data.svc/{*data}",false);
My thinking is that I can just point the extensionless url at the configured .svc url. This doesn't work -- the /Data.svc continues to work, but /Data returns a 404.
I did find a work-around if using urlMappings in config like this, in conjunction with serviceActivation above:
<urlMappings>
<add url="~/Data" mappedUrl="Data.svc"/>
</urlMappings>
The problem with this is twofold - 1. It seems convoluted 2. In the generated WSDL, the operation endpoints still refer to Data.svc/, rather than Data/ -- therefore theres dependency on Data.svc actually existing / responding.
This is not really what I want, even if it kinda / sorta solves the problem.
Is there a proper way of getting extensionless WCF service urls to generate WSDL correctly?