title: WCF service access from client application when user is behind proxy
body: <p>I have a WCF service hosted on a server. A client application is accessing the service on a windows 7 machine. There are two users on Windows 7 machine. Windows application is a installed through Clickonce so separate instance will be there for two users. </p>
  
  <p>When userA accessing the service through Winforms application it works fine, but when userB on the same machine trying to access it throws following exception:
  Communication Exception: The remote server returned an unexpected response: (417) Expectation failed.</p>
  
  <pre><code>Server stack trace: 
     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&amp; msgData, Int32 type)
     at Myapp.ServiceProxy.IMyAPIService.GetData(String userName, String passWord)
  </code></pre>
  
  <p><strong>What could be the reason behind working for one user and not for other? Am I missing anything?</strong></p>
  
  <p><strong>UPDATE</strong>:
  Though I found a solution (Please see my answer below) to this issue but still wanted to know what should be done in this scenario. As MSDN <a href="http://msdn.microsoft.com/en-us/library/system.net.servicepointmanager.expect100continue.aspx" rel="noreferrer">article</a> says it blocks user to send large amount of data to server, but it didn't mention about any limit in that?</p>
  
  <p>What is the limit of data client can send to server? Is there any better approach for connecting a WCF service from a client who is behind proxy? </p>