Reputation: 3752
So I have a WCF service that calls another WCF service. I'm trying to debug the first service, so I attempted to run it. It fails with a
There was no endpoint listening at
http://<host>/ConfigurationService/ConfigurationService.svc
that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
The inner exception is
{"The remote server returned an error: (404) Not Found."}
Reference:
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IConfigurationService/GetGlobalConfigurationGroup", ReplyAction="http://tempuri.org/IConfigurationService/GetGlobalConfigurationGroupResponse")]
ConfigurationGroup GetGlobalConfigurationGroup();
Taking that exact endpoint and putting it in a browser works. Taking it and putting it in WCFTestClient works. This code is already running in production, so I don't know what I'm doing wrong. I debug into the call and I see it's being sent as a POST instead of a GET. I'm assuming that's the culprit, but I have no idea on how to fix it or why it's magically different. I've looked at WCF method sending POST instead of GET and the link in that answer, but I don't understand it, couldn't get it to work, and the class that extends it is a generated class and won't debug into it either.
I put on failure request logging on the Configuration service, which logs something if I go to a bad location (ConfigurationService.svc1) but not when calling this.
<system.serviceModel>
<client>
<endpoint address="http://<host>/SecurityService/SecurityService.svc"
behaviorConfiguration="defaultBehavior" binding="basicHttpBinding"
bindingConfiguration="defaultHttpBinding" contract="Service.ISecurityService"
name="SecurityService" />
<endpoint address="http://<host>/ConfigurationService/ConfigurationService.svc"
behaviorConfiguration="defaultBehavior" binding="basicHttpBinding"
bindingConfiguration="defaultHttpBinding" contract="Service.IConfigurationService"
name="ConfigurationService" />
</client>
<bindings>
<basicHttpBinding>
<binding name="defaultHttpBinding" closeTimeout="00:10:00" openTimeout="00:10:00"
receiveTimeout="00:10:00" sendTimeout="00:10:00" maxReceivedMessageSize="2147483647" />
</basicHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="defaultBehavior">
<dataContractSerializer ignoreExtensionDataObject="true" maxItemsInObjectGraph="2147483647" />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
Config for Configuration Service:
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
<services>
<service name="ConfigurationService" behaviorConfiguration="defaultBehavior">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="defaultHttpBinding"
contract="IConfigurationService"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="defaultHttpBinding" maxReceivedMessageSize="2147483647" openTimeout="00:10:00" closeTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00">
<readerQuotas maxStringContentLength="2147483647" maxArrayLength="20971520"/>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="defaultBehavior">
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
Edit: I've noticed that it only exhibits this behavior when running a web project.
Upvotes: 1
Views: 1660
Reputation: 76
In a multi-process environment where services are distributed and applications using those services are communicating via WCF, service contracts must be serialize-able. The easiest way to ensure serialization of contract objects is to decorate them with data contracts attributes as described here: https://msdn.microsoft.com/en-us/library/ms733127%28v=vs.110%29.aspx
Without proper serialization your services will still work under some conditions and unless you're attached to all your relevant processes while debugging you won't see any error thrown. Even logging will sometimes fail to show anything (or at least anything useful).
This likely isn't a configuration problem since you're using dataContractSerializer. Decorate your service contract classes so they can be serialized over WCF.
Upvotes: 1
Reputation: 653
I once had this problem. Turns out I had the wrong address for the service in the configuration of my web project.
Upvotes: 0
Reputation: 1907
Try using Data Contracts in the service that you are trying to call.
https://msdn.microsoft.com/en-us/library/ms733127%28v=vs.110%29.aspx
Here a brief explanation about what they are and how they works.
I think that this is the error because of your error 'OperationContractAttribute'
Maybe is only the ServiceContract.
I hope this helps
Upvotes: 1