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.
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
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.
I once had this problem. Turns out I had the wrong address for the service in the configuration of my web project.
Related
I have gone through this post and answer in depth: https://stackoverflow.com/a/20667308/463196
and am still getting the 413 Request Entity Too Large Error from the WCF Client (consumer of the Service Reference).
I've increased the maxXYZSize for everything, and my binding name "TransportSecurity" is bound to the endpoint correctly.
From Web.config of Service (Provider):
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="TransportSecurity" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" closeTimeout="10:00:00" openTimeout="10:00:00" receiveTimeout="10:00:00" sendTimeout="10:00:00">
<readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="" name="GeneratePdf_CloudService.IService1">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="TransportSecurity" contract="GeneratePdf_CloudService.IService1" listenUri="">
<identity>
<dns value=""/>
</identity>
</endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false before deployment -->
<serviceMetadata httpGetEnabled="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="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
Does anyone see anything I am missing?
Thanks!
EDIT: Oops. Some more relevant information ... I am doing an Azure WebJob as the WCF Client, should have mentioned that.
So for all intents and purposes, it is a Client App that uses AppName.exe.config. I am going to go and provide information on that end and see if it helps.
Recently we added HTTPS to one of our WCF services that is exposed over REST and SOAP endpoints.
When we made this modification, the SOAP endpoints are experiencing issues that I am unable to find fixes for.
The problem I am having right now is that when the HTTP endpoint is consumed, the SOAP address given in the WSDL is pointing to the local address. This is not allowing the service to be consumed over HTTP and only of HTTPS.
The web.config is the following for the relevant section:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="basicHttpsBinding">
<security mode="Transport"/>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="MyServiceBehavior"
name="Some.Path.To.MyService">
<endpoint address="" binding="basicHttpBinding"
bindingConfiguration="basicHttpsBinding"
contract="Some.Path.To.IMyService"/>
<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="PingPostServiceBehavior">
<serviceThrottling maxConcurrentInstances="800"
maxConcurrentCalls="800"
maxConcurrentSessions="800"/>
<!--<useRequestHeadersForMetadataAddress/>-->
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above 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="false"/>
</behavior>
</serviceBehaviors>
When I go to the PRODUCTION HTTP WSDL address, the local address is given in the soap address element as shown in following image. I apologize about the bad censor job.
I created a WCF service.
In the WSDL I can't see the URL and PORT that the service should bind on.
All I see is:
<wsdl:service name="SimpleWebService"/>
Any idea what am I doing wrong? maybe something in the web.config?
<system.serviceModel>
<client />
<bindings>
<webHttpBinding>
<binding closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" />
</binding>
</webHttpBinding>
</bindings>
<services>
<service name="WS.OS.SimpleWS" behaviorConfiguration="myServiceBehavior">
<endpoint name="webHttpBinding" address="" binding="webHttpBinding" contract="WS.OS.SimpleWS" behaviorConfiguration="webHttp" />
<endpoint name="mexHttpBinding" address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="myServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="webHttp">
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
Creating an endpoint with webHttpBinding creates a REST endpoint. REST endpoints does not have wsdl. In your case you see wsdl generated because you have included the metadata behavior. You will have an endpoint listed in WSDL only for SOAP endpoints. This is a good blog post which helps you to understand this better : http://blogs.msdn.com/b/carlosfigueira/archive/2012/03/26/mixing-add-service-reference-and-wcf-web-http-a-k-a-rest-endpoint-does-not-work.aspx
Looking at the question, and the config, I'm assuming (we all know where that leads) that your service is hosted in IIS. So given the address of "" and no port given, you will have to look in your IIS settings to find the site and the port on which the service is open. The defualt for http is 80 and https is 443.
So quick example, if your service is on the "Default Website" of the IIS then your service will probably be at:
http://YourServer/YourService/YourService.svc
If there is a web application that is hosted on there that is under a specificly different site, you will need to look into the setting of IIS to find it. It is common also to have IIS host the SVC as default page so you could have just the first two parts and not the actual page in your URI. I don't think you will have much luck unless you start digging into your web server.
My WebConfig:
<bindings>
<webHttpBinding>
<binding name="SecureBasicRest">
<security mode="Transport" />
</binding>
</webHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="svcBehavior">
<serviceMetadata httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="svcEndpoint">
<webHttp helpEnabled="true"/>
<enableWebScript/>
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service name="SvcContract.Authenticate" behaviorConfiguration="svcBehavior">
<endpoint binding="webHttpBinding" bindingConfiguration="SecureBasicRest"
behaviorConfiguration="svcEndpoint" name="webHttp"
contract="SvcContract.Authenticate" />
</service>
</services>
I have to make this work with
https://localhost:6188/Authenticate/Login?username=user&password=pass&ip=127.0.0.1
Change
<serviceMetadata httpsGetEnabled="true"/>
to
<serviceMetadata httpsGetEnabled="false"/>
You're telling WCF to use https for the metadata endpoint and I see that your'e exposing your service on http, and then you get the error in the title.
You also have to set <security mode="None" /> if you want to use HTTP as your URL suggests.
You would need to enable https binding on server side. IISExpress in this case. Select Properties on website project in solution explorer (not double click). In the properties pane then you need to enable SSL.
I solved the issue by adding https binding in my IIS websites and adding 443 SSL port and selecting a self signed certificate in binding.
To make it work you have to replace a run this line of code
serviceMetadata httpGetEnabled="true"/> http instead of https
and security mode="None" />
In the endpoint tag you need to include the property address=""
<endpoint address="" binding="webHttpBinding" bindingConfiguration="SecureBasicRest" behaviorConfiguration="svcEndpoint" name="webHttp" contract="SvcContract.Authenticate" />
In our case; I had to remove the "<baseAddressPrefixFilters" from the config file.
I have a WCF service method in a Silverlight application that inserts some data into a SQL Server database deployed on a shared GoDaddy server. Some of the methods work, and some do not, but all of them work when the application is run locally (with a local database). I get the generic "The remote server returned an error: NotFound", and I can't seem to get any more info. When I run the method directly from the service class (not through the service reference), it works correctly. Here is the service part of my web.config:
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<behaviors>
<serviceBehaviors>
<behavior name="default">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="6553600" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IncreasedBuffer"
maxBufferSize="2147483647" maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647">
<readerQuotas maxBytesPerRead="2147483647" maxDepth="2147483647"
maxArrayLength="2147483647" maxNameTableCharCount="2147483647"/>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="GreekTools.Services.DataService"
behaviorConfiguration="default">
<endpoint address="" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IncreasedBuffer"
contract="GreekTools.Contracts.IDataService" />
<endpoint address="mex" binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
Any ideas?
Could it be that you have an older version of the dll deployed on the server side. That would explain why some work and some do not.
If this is not the case, is there any pattern in what works and what does not?
This is usually the case when you attempt to do a request on a url that does not exist. For example, you expect a service to be at http://hostname/path/Service.svc but it actually lives at http://hostname/Service.svc.
Your best course of action is to download a web debugging tool (Fiddler is a good choice) and check the actual requests that are sent from your Silverlight client to your web server. Very probably you'll see some problem with a url path that's incorrect.