access to basicHTTP binding through WCF - results in Forbidden - wcf

I am trying to access a web service using WCF client application in CS, when trying to access the web method. I am getting the forbidden error.
Binding configuration:basicHttpBinding
endpoint address=http://xxxxx/yyyy/WebServices/Soap/Query.svc
I noticed 1 more thing - when I try to add the service reference to WCF through VS - it is https://xxxx/yyyy/Webservices/Soap but in app Config it shows http.
Does anyone know how to handle this or what I am missing?
Please do help for the same.
Here is the call stack for the same:
Server stack trace:
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at ConsoleApplication1.xxxxxx.Query.Result(String userName, String password, String workflowName, String queryId, QueryData data)
at ConsoleApplication1.UTPQueryService.QueryClient.Result(String userName, String password, String workflowName, String queryId, QueryData data) in

Related

exceptions while calling WCF service from client

When I try to call the WCF on client machine it fails with the following exception. The funny part is sometimes it works perfectly fine. Can anyone assist me on this.
Server stack trace:
at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameterPart(XmlDictionaryReader reader, PartInfo part, Boolean isRequest)
at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameter(XmlDictionaryReader reader, PartInfo part, Boolean isRequest)
at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, String action, MessageDescription messageDescription, Object[] parameters, Boolean isRequest)
at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(Message message, Object[] parameters, Boolean isRequest)
at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeReply(Message message, Object[] parameters)
at System.ServiceModel.Dispatcher.ProxyOperationRuntime.AfterReply(ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at FixedIncomeReconciliation.ServiceReference1.IFixedIncomeSettlementsService.GetDataService(DateTime date, String isRecon, String tabCaption)
at FixedIncomeReconciliation.ServiceReference1.FixedIncomeSettlementsServiceClient.GetDataService(DateTime date, String isRecon, String tabCaption)
at FixedIncomeReconciliation.ViewModel.MainConfirmsViewModel.ServiceCall(String isRecon, String tabCaption)

Cannot make a call on this channel because a call to Open() is in progress - WCF

I am getting the following error while I invoke WCF service from time to time. Quick reply would be appreciated
Cannot make a call on this channel because a call to Open() is in progress.
Full exception details
Timestamp: 15/03/2012 2:38:06 AM
Message: HandlingInstanceID: 9727709e-2d51-43d3-b45e-58c105cc3791
An exception of type 'System.InvalidOperationException' occurred and was caught.
03/15/2012 13:38:06
Type : System.InvalidOperationException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Message : Cannot make a call on this channel because a call to Open() is in progress.
Source : mscorlib
Help link :
Data : System.Collections.ListDictionaryInternal
TargetSite : Void HandleReturnMessage(System.Runtime.Remoting.Messaging.IMessage, System.Runtime.Remoting.Messaging.IMessage)
Stack Trace :
Server stack trace:
at System.ServiceModel.Channels.ServiceChannel.ThrowIfOpening()
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Choosi.Centrix.UnderwriterWebService.UnderwrittingService.IService.UpdateApplicationDetails(AppStatus appStatus, Nullable`1 ruwStatus, MoreInfoRequired[] moreInfoRequiredList, Int32 uwQuestionSetInstanceId)
regrads,
Raj

Exception when making a call to DB and returning a List<T>

I am making a WCF service that connects to a database and return results. One out of four DataContracts works without a problem (that return an int) but the other three give me an exception (that return a List). Below the error message.
The underlying connection was closed: The connection was closed unexpectedly.
Server stack trace: at
System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException
webException, HttpWebRequest request, HttpAbortReason abortReason)
at
System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan
timeout) at
System.ServiceModel.Channels.RequestChannel.Request(Message message,
TimeSpan timeout) at
System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message
message, TimeSpan timeout) at
System.ServiceModel.Channels.ServiceChannel.Call(String action,
Boolean oneway, ProxyOperationRuntime operation, Object[] ins,
Object[] outs, TimeSpan timeout) at
System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage
methodCall, ProxyOperationRuntime operation) at
System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage
message)
Exception rethrown at [0]: at
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg) at
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type) at IReceiverService.SatList() at
ReceiverServiceClient.SatList()
Inner Exception: The underlying connection was closed: The connection
was closed unexpectedly. at System.Net.HttpWebRequest.GetResponse()
at
System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan
timeout)
You probably need to decorate the entities returned or the service with known type attributes

WebHttpBinding authentication ignored

I'm trying to use basic HTTP authentication with a REST service, but debugging proxy shows that no authentication headers are sent at all, they are ignored! Here is my code:
WebChannelFactory<IMyService> factory = new WebChannelFactory<IMyService>(
new WebHttpBinding(),
new Uri("http://10.6.90.45:8081"));
WebHttpBinding http = (WebHttpBinding) factory.Endpoint.Binding;
http.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
http.Security.Mode = WebHttpSecurityMode.TransportCredentialOnly;
factory.Credentials.UserName.UserName = "username";
factory.Credentials.UserName.Password = "password";
IMyService proxy = factory.CreateChannel();
proxy.SomeMethod();
...
The HTTP request is unauthorized with client authentication scheme 'Basic'. The authentication header received from the server was ''.
Server stack trace:
at System.ServiceModel.Channels.HttpChannelUtilities.ValidateAuthentication(HttpWebRequest request, HttpWebResponse response, WebException responseException, HttpChannelFactory factory)
at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory factory, WebException responseException, ChannelBinding channelBinding)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
...

WCFTestClient exception on deployed service

I use the WCFTestClient that is provided with visual studio to test my service.
The thing is that the tool is working for the service that is deployed in wisual studio with my aplication. But if I try to connect to a deployed instance on another machine I get the following exception. Has anyone solved this issue?
The service uses WindowsAutentication.
The HTTP request is unauthorized with client authentication scheme 'Negotiate'. The authentication header received from the server was 'Negotiate oX0we6ADCgEBonQEcmBwBgkqhkiG9xIBAgIDAH5hMF+gAwIBBaEDAgEepBEYDzIwMTAxMDI3MDgzNTIxWqUFAgMCED6mAwIBKakLGwlCQVcuTE9DQUyqJzAloAMCAQOhHjAcGwRob3N0GxRsYmFpdGVzdDAxLmJhdy5sb2NhbA=='.
Server stack trace:
at System.ServiceModel.Channels.HttpChannelUtilities.ValidateAuthentication(HttpWebRequest request, HttpWebResponse response, WebException responseException, HttpChannelFactory factory)
at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory factory, WebException responseException, ChannelBinding channelBinding)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at IBCMService.GetAllRegions()
at BCMServiceClient.GetAllRegions()
Inner Exception:
The remote server returned an error: (401) Unauthorized.
at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
Inner Exception:
The target principal name is incorrect
at System.Net.NTAuthentication.GetOutgoingBlob(Byte[] incomingBlob, Boolean throwOnError, SecurityStatus& statusCode)
at System.Net.NTAuthentication.GetOutgoingBlob(String incomingBlob)
at System.Net.NegotiateClient.DoAuthenticate(String challenge, WebRequest webRequest, ICredentials credentials, Boolean preAuthenticate)
at System.Net.NegotiateClient.Authenticate(String challenge, WebRequest webRequest, ICredentials credentials)
at System.Net.AuthenticationManager.Authenticate(String challenge, WebRequest request, ICredentials credentials)
at System.Net.AuthenticationState.AttemptAuthenticate(HttpWebRequest httpWebRequest, ICredentials authInfo)
at System.Net.HttpWebRequest.CheckResubmitForAuth()
at System.Net.HttpWebRequest.CheckResubmit(Exception& e)
You can right click on the config file in wcftestclient, click copy Full path, open the path it in an editor and check that the security settings match the deployed service configuration