Reputation: 238048
In a WCF service hosted in IIS, I'm trying to set up multiple endpoints. One for SOAP and one for SOAP12. Per the MSDN documentation, I've edited Web.config
like:
<services>
<service name="MyNamespace.MyClass">
<endpoint address="" binding="basicHttpBinding" contract="IContract" />
<endpoint address="Endpoint2" binding="wsHttpBinding" contract="IContract" />
</service>
</services>
This doesn't seem to have any effect. There is no answer on URL:
http://localhost:51454/MyClass.svc/Endpoint2
If I change IContract
to IContract2
, I get the error:
The service '/MyClass.svc' cannot be activated due to an exception during
compilation.
So the Web.config
I'm editing is the one being used.
Changing the binding for the default address from basicHttpBinding
to wsHttpBinding
doesn't have any effect. The WSDL stays the same.
The WSDL includes this bit, which seems to suggest that it's running using a generated binding:
<wsdl:service name="TapasSim">
<wsdl:port name="BasicHttpBinding_IContract"
binding="i0:BasicHttpBinding_IContract">
<soap:address location="http://localhost:51454/MyClass.svc"/>
</wsdl:port>
</wsdl:service>
Why does the WCF service not use the configuration from Web.config
?
Why does WCF not listen on /Endpoint2
with the SOAP12 binding?
Why does the default endpoint not change from basicHttpBinding
to wsHttpBinding
?
Upvotes: 0
Views: 1643
Reputation: 238048
The problem was the service name:
<service name="MyNamespace.MyClass">
The class name was wrong. When you enter a wrong contract interface, WCF throws an error. But a wrong class name is silently ignored. That explains why it fell back on the default configuration.
Upvotes: 0
Reputation: 1269
The MSDN article is correct and there is nothing wrong in your configuration. I created a WCF client using VS and was able to successfully call using
http://localhost:51454/MyClass.svc/Endpoint2
Apparently, it does not appear as a valid url from browser. try consuming from a client using the second url and it should work
Upvotes: 1
Reputation: 11277
Try adling a base adress for the endpoint:
<service name="namespace.Service">
<host>
<baseAddresses>
<add baseAddress="http://localhost:51454/myclass.svc"/>
</baseAddresses>
</host>
// endpoint omnited
Or try adding a slash before the address:
endpoint address="/Endpoint2" binding="wsHttpBinding" contract="IContract"
Upvotes: 1