Getting 401 when WCF OperationInvoker calls another WCF service - wcf

We have an attribute called LoggingImplementationBehavior that causes a WCF Logging service to get called before and after service calls it's attached to.
This works great both locally and on the shared development server. However, on the staging server a 401 error is returned when a call is made to the Logging service from the invoker. To ensure that the issue is not in the Logging service I commented all code out so that it does nothing, but I still get this error when the stub is called.
In IIS Manager, Anonymous Authentication is enabled (and nothing else) at both the server level and at the services website level. Digest Authentication is disabled at both levels, so what could be the cause of these 401 errors?
I've seen others have this problem with large data but the data being sent here is quite small.
Any tips on how to continue debugging this problem would be greatly appreciated as I'm currently at a dead end.
The exact text of the error is:
The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Digest qop="auth",algorithm=MD5-sess,nonce="+Upgraded+v171b25f8f2632897bff13b10710dac91aa1d64068a3cccf011b44f8580e932354dfd50d56778ba404d674864cf9d5216e589c616fb1a48583",charset=utf-8,realm="Digest"'.
The remote server returned an error: (401) Unauthorized.

Related

Request To WCF service is not hitting on application level from Java application

I have a SOAP WCF service hosted in IIS and it is consumed by another company SAP system and everything was working fine for couple of years until our security team implemented Header validation in request and it stopped working all of sudden since the client SAP system request doesn't contain header CallingType. So then they added CallingType and pushed request to our system and F5 server allowed access and request entered to our system where WCF hosted. But WCF did not logged request and no data we got. So i would like to know how i can troubleshoot and provide fix. My network team is telling request is validated and passed by F5 server and pushed to our server. But why WCF is not logging anything??Do i need to add any custom header in webconfig of WCF service, or our IIS is preventing something? How can i see IIS is blocking the request.

An error occurred while receiving the HTTP response to ''. This could be due to the service endpoint binding not using the HTTP protocol

I am getting the below error while trying to call an external service from my service which was hosted in IIS .
Error : An error occurred while receiving the HTTP response to ''. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.
And I am not getting any error while trying to call the same external service from a console application.
Any suggestions will help. Thanks in advance.
Issue is with the firewall. When i try to call the external service from console application, the service call going through without any errors, as there was no IIS involved in calling the service. But when i call the external service from another service hosted in IIS, firewall comes to the picture.

WCF: Randomly does not respond

I have a peculiar problem with client requests randomly not getting a response to a WCF service call.
The setup is a Silverlight 5 application making calls to a WCF service, using both HTTP and PollingDuplex bindings. The SL makes a number of requests upon loading (20+ in 20s), and every now and then does not receive a response to one or two of them. To be clear, the exact same request works 90% of time, if I refresh the page all requests could get a response.
The error cannot be the actual request sent. I use Fiddler to validate this as well, since I see the request being made (make sure the content is the same as previous successful requests), but there is no response to the request. Eventually the client times out the request. The WCF service is hosted in IIS7, and I have diagnostics and logging enabled on both. In the WCF server trace logs, I only see message logged when the client times the request out. It has the following exception action logged under a "Processing message" activity, at the time of the client timing out:
"The number of bytes available is inconsistent with the HTTP Content-Length header. There may have been a network error or the client may be sending invalid requests."
This is as if the body of the HTTP is not getting through to WCF (I do not know if I can log the full request received by IIS before passing to WCF handlers?). As I said, using Fiddler I can see the full message is valid (note that this behaviour also occurs when Fiddler is not sniffing the traffic, so I've ruled Fiddler out as the problem).
Typically the "Processing message" activity has a "To: Process action xxx"
Like I said this occurs with Http and PollingDuplex services, on my dev box as well as production web servers. Occurs on different endpoints as well, and I don't think it has to do with WCF throttling behaviour, since it occurs
Any information or help will be appreciated to get to the cause, whether it's additional information I can gather to help diagnose or any hints.

Getting a MethodAccessException(in event log of server) and HTTP Error 401 Unauthorized(at client side) in WCF Rest Service in IIS6.0 Win2K3 enviorn

I wrote a WCF REST based service that uses webHttpBinding and uses JSON to post data.This service works fine in all of our internal environments. But in one of our environment which is exact replica of Production. It is not working. If I inspect in Firebug, I see "HTTP Error 401 Unauthorized" and in server I See following in the event log.
System.MethodAccessException
System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous
MethodAccessException: System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(System.Web.HttpApplication, Boolean) at System.ServiceModel.Activation.HttpHandler.ProcessRequest(HttpContext context)
I haven't pasted the whole event log. But,afore are the key parts of it.
I am not able to figure out what is happening, we are using custom httpmodule for authentication.
Need urgent help on this
Thanks in advance
From MSDN, a MethodAccessException occurs when you try to call a private/protected method from somewhere that you aren't allowed. This is thrown during reflection, which is more than likely what WCF is doing under the covers.
My bet is that one of your service methods is marked as private or protected.
This would work in your local environment because it's under Full Trust. Your production environment is most likely running in Medium Trust. (Under Medium Trust, you aren't allowed to bypass the accessibility modifiers.)
-- Tatham

Silverlight WCF Service to Service calls

Question:
Are there known issues making calls to a service that calls another service from Silverlight?
Scenario:
I have the following 3 projects:
SilverlightClient - Silverlight project with a Button
SilverlightClient.Web - A web application that hosts the SilverlightClient.xap.
BackEnd - A different web application that hosts the FOO Service which does some special backend processing.
I have created a Silverlight WCF-Enabled web service in both SilverlightClient.Web and Backend. These are respectively SilverlightClientService and BackEndService.
From SilverlightClient.Web I add a service reference to BackEndService. I have a test ASPX page that I've written code that calls BackEndService successfully.
From SilverlightClient I add a service reference to SilverlightClient.Web's SilverlightClientService. If my SilverlightClientService returns plain data, such as a string, it works quite well.
The moment, however, that I change SilverlightClientService to call BackEndService, I get the following exception:
HTTP 415 - "The request failed with HTTP status 415: Unsupported Media Type."
I had an issue with 2 services not communicating. We finally figured out that using Cassini (the built in Visual Studio IIS) to host the ListenerService 'BackEnd' was causing the problem. Switching the project to start in a virtual directory of IIS allowed the two to communicate.
I was seeing : An error occurred while receiving the HTTP response to http://localhost:1484/MainListenerService.cs. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details. and this error:
The HTTP request was forbidden with client authentication scheme 'Anonymous'.
Are you using basicHttpBinding? Silverlight only supports basicHttpBinding but the default when you create a WCF service is wsHttpBinding. You should change that on your web.config before adding the reference on your Silverlight project. Check out this video from Tim Heuer: http://silverlight.net/learn/videos/all/how-to-consume-wcf-and-aspnet-web-services-in-silverlight/