WCF service problem - wcf

I created one wcf service lets called as "myService.svc". From my service I am calling client service lets say "clientService.svc". This client service return data to my wcf service.
Today I start getting exception like "There was no endpoint listening at http://clientService.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details...."
So where is this problem probably present inside client service or my service as both service are up so I am not able to figure ut out?
Please help me out.

you web.config has the wrong URL for the client service. Change it to "http://localhost/clientservice.svc".

Check your endpoint configuration... http://clientService.svc is an invalid uri.

Did you try accesing the WSDL via browser?
It seems like the url is wrong maybe in the client, i think it should be something like http://nameofthehost/clientService.svc
to access the wsdl you should add ".wsdl" at the end of the url

How are you running those services? If you are using asp.net development server, its possible, that you got your services running at different ports today. Your inner service's proxy is configured at some address which isn't valid any more. Check the setting and try refreshing the service (right clicking at solution explorer) and possibly change the address or generate proxy again.

Related

Getting a "Failed to invoke the service" while trying to invoke a wcf service

I am trying to host a Wcf Service on the IIS, but am unable to do so. I have the service inside a website in IIS added as an application and am also able to get the wsdl for the service. But when trying to hit the service through the WcfTestClient, I get the following error -
Failed to invoke the service. Possible causes: The service is offline or inaccessible; the client-side configuration does not match the proxy; the existing proxy is invalid. Refer to the stack trace for more detail. You can try to recover by starting a new proxy, restoring to default configuration, or refreshing the service.
I have gone through the steps to host a wcf service on the IIS. Not sure what I am missing or doing wrong. Thanks in advance for any help.
It seems there is error in WCF.
Try putting
try and catch
or
make a empty method to return Hello World

WCF Service Accounts

I have a WCF self-hosted as a Windows Service.
When I start the service (under the NETWORK_SERVICE account), I can consume the service from my ASP.NET application on a different server.
However, the business rules have changed. Now I need to run the service under my own account. I am able to stop the service, and start it again under my account. No problem there.
Until I try to consume the service from my ASP.NET application on the other service. I get:
A call to SSPI failed, see inner exception
I'm relatively certain there's something I need to do security wise to eliminate this error, being new to all this I just don't know what.
Any help is greatly appreciated.
Thanks,
Jason
Usually this is a sign of a missing or misconfigured SPN, which gets in the way when you're using windows authentication (at the transport or message level) and Kerberos is being negotiated.
Notice that how/when the error manifests itself might depend on the way the hostname (or IP address) of the service host is used in the URL used by the client, since WCF will try, by default, to deduce the right SPN to use based on the URL information, unless you explicitly override it by setting the endpoint identity.
So likely all you need to do is register an SPN (using setspn.exe) for your new service and make sure your client uses an appropriate identity.
There's some more extra information on how WCF uses service identities here, here and here.

WCF Service calling another WCF service fails with web error 400 Bad Request

We have a web service that is called when user clicks save button on web form. The 'save' web service then makes a call into another web service (different machine). The call always fails and as far as I can tell does not even attempt to cross the network because the Fiddler traffic is empty. This problem only occurs when we call the second web service from the first web service. If we call the second web service straight from the client or on page load, it works. We are using WebHTTPBinding with REST type services.
I used the WCF trace to come up with the error 'Envelope Version 'EnvelopeNone (http://schemas.microsoft.com/ws/2005/05/envelope/none)' does not support adding Message Headers.', but I don't know how to resolve it.
Any suggestions?
Possible fixes:
Check #ServiceHost directive( in
. svc file) is set to
"WebServiceHostFactory" source
WebHttpBeahvior element is added in
the endpoint behavior source
Put ORDER information in the XML
schema Class source
Check that your Data Transfer objects are
serrializable source
Check if Skype installed and make sure it
doesn't overtake the port
source
Remove SOAP message header (it is not supported for REST
WCF) source

wcf service stops after few requests

I am working on an application where i am using a wcf service. I am currently hosting my service on localhost and accessing it from there only by adding the service reference in my project. On one of my page i am sending request on change of selected index on dropdown list. It works fine for first few requests but suddenly stops after that giving following excsption
"Failed to invoke the service. Possible causes: The service is offline or inaccessible; the client-side configuration does not match the proxy; the existing proxy is invalid. Refer to the stack trace for more detail. You can try to recover by starting a new proxy, restoring to default configuration, or refreshing the service."
How can service stop without any reason and that too from my localhost. It only works for first 3-4 requests. In service i am just sending a integer and getting back the records on its basis using a class in a generic list.
Thanks in advance
What protocol / bindings are you using? Can you show us the config? Anything inside the <system.serviceModel> on both the server and the client side.
Do you maybe create a client proxy and call the service method and not properly close and dispose of the client proxy? In that case, you might run out of connections at some point - but that's next to impossible to tell without some code to see what you're doing. Can you show us the service contract in question, and the code how you call it from the client side?

WCF - EndpointNotFoundException, There was no endpoint listening

My WCF Service is hosted under Windows Service and in case it is not running when client makes a call to its methods, client gets the EndpointNotFoundException with this message:
There was no endpoint listening...
Is there a way I can check if the WCF service is up and running before making calls to the service methods?
Thank you!
Besides just calling it?
You could try pinging it, but that would just tell you that it exists and that its running, not that it's able to accept calls or anything.
UPDATE
To ping the web service you can use the Ping class from System.Net.NetworkInformation.
A solution may be to make a 1st 'dummy' call, if that exception is encountered conclude that it's not running.
You could expose the service contract as WSDL, if possible. If you can reach the WSDL page, then it's running, otherwise it's not.