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.
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.
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& msgData, Int32 type)
at Myapp.ServiceProxy.IMyAPIService.GetData(String userName, String passWord)
What could be the reason behind working for one user and not for other? Am I missing anything?
UPDATE:
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 article says it blocks user to send large amount of data to server, but it didn't mention about any limit in that?
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?
Finally I cracked it. It happens because the user is behind a proxy.
Following setting in the app.config resolved the issue:
<system.net>
<settings>
<servicePointManager expect100Continue="false" />
</settings>
</system.net>
But this is still an issue for large file upload, looking for a solution for the same now.
More information on this in MSDN article
Related
I am migrating WCF services to a new 2019 server running IIS10.
The server that these services come from is a IIS8.5 running on Server 2012R2.
It is obvious that a IIS backup/restore might/will fail as a number of discussions will suggest.
I have set up my remote deployment from VS2019 the same as for the old server.
I can deploy webs and REST services without any problems - BUT WCF services fail:
Fiddler reports 404 Not Found.
Calling the service via test programs under debug brings up the following:
25-02 11:09:43 [24016] FATAL bSm.Kll.Program - System.ServiceModel.ProtocolException: The remote server returned an unexpected response: (405) Method Not Allowed. ---> System.Net.WebException: The remote server returned an error: (405) Method Not Allowed.
at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
--- End of inner exception stack trace ---
Server stack trace:
at <System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory1 factory, WebException responseException, ChannelBinding channelBinding)<br> at System.ServiceModel.Channels.HttpChannelFactory1.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)
I am reasonable sure that I am missing credentials for the service, the problem is WHERE / WHAT is the additional requirement enforced by this server.
As an aside:
I already ran across the problem that the Web Deployment tool has a extra requirement for a "User delegate" which was quite a hurdle on its own. The 3.6 version of the tool had to be collected from the MS website before this requirement was revealed.
Please note that that this question encountered while doing the implementation with the use of OCPP1.5 (Open charge point protocol 1.5).
Mentioned below are the steps I followed in order to connect with the charge point.
Chargepoint.wsdl was converted to the interface class with the use of
wsdl.exe tool provided in Visual Studio.
Created the service class by implementing the service class with the
charge point interface created in step 1 and implemented the methods.
Created the Central System and added the Chargepoint.wsdl as the
service reference to the Central System.
From the Central System, called the method implemented in the ChargePoint.
I have mentioned below the error occurred while calling the ChargePoint methods from the Central System
System.ServiceModel.ServiceActivationException: The requested service, 'http://192.168.40.221/ssamadhi/RCUControl.svc' could not be activated. See the server's diagnostic trace logs for more information.
Server stack trace:
at
System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory1 factory, WebException responseException, ChannelBinding channelBinding)
at System.ServiceModel.Channels.HttpChannelFactory1.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)
Please mention where did I go wrong.
Thank you
try resetting iis.
Just open Windows PowerShell as Administrator and run iisreset.
I have WCF service which is returning data of 6500 rows of data list. When I am trying to retrieve that data from service it is throwing error like -
An error occurred while receiving the HTTP response to http://myservice.myDomain.com/Services/myTestService.svc. 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
I have tried to increase the time in configuration still the issue persists.
in Trace I am getting same like below :
Trace log it is showing the error like the same below :
An error occurred while receiving the HTTP response to http://myservice.myDomain.com/Services/myTestService.svc. 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.
stack Trace:
System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)
System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
The first thing you should do is set up and start using the service trace viewer tool, this will allow you to drill further down into the specific call and find out exactly what the error is.
http://msdn.microsoft.com/en-us/library/ms732023(v=vs.110).aspx
http://msdn.microsoft.com/en-us/library/ms751526(v=vs.110).aspx
Once you get this up and running you can run your code and then view the specific error you are getting, this will quite often be able to tell you what field or object is causing the error. The error you are getting in your debug is just a sign that something failed, you need to use a trace viewer to see what.
Without the actual error from the logging, it's hard to say exactly what is causing the error, however the most common cause is a lack of proper serialization on the object being returned by the service.
EDIT:
Looking at your stack trace it looks like you may have a cyclical reference somewhere in the object being returned, you'll need to add the IsReference=true flag to the offending objects http://msdn.microsoft.com/en-us/library/system.runtime.serialization.datacontractattribute.isreference(v=vs.95).aspx
If you can post the code for the object(s) being returned I may be able to better point you at the issue.
EDIT 2: Also, if you can post the XML for the exception in the svclog file (copy the contents of the XML tabl in the Service trace viewer), that would shed further light also.
We are sporadically experiencing an error that is causing issues for one of our WCF / Websphere MQ applications. We are encountering the error:
Websphere MQ Server: 7.1
Websphere MQ Client: 7.1
.Net 4.0
----- amqrmrsa.c : 887 --------------------------------------------------------
1/23/2013 06:13:26 - Process(2928.79887) User(svcPrideDaca) Program(amqrmppa.exe)
Host(MQTEST) Installation(MQServer7101)
VRMF(7.1.0.0) QMgr(QM_mqtest)
AMQ9504: A protocol error was detected for channel 'SYSTEM.DEF.SVRCONN'.
EXPLANATION:
During communications with the remote queue manager, the channel program
detected a protocol error. The failure type was 11 with associated data of 252.
ACTION:
Contact the systems administrator who should examine the error logs to
determine the cause of the failure.
Error we are getting in our WCF .Net App:
2013-01-23 06:13:25,435 [113] ERROR - [pride-N25Scan].[EnqueueMessage] <54321> (9999) Error enquing message:WCFCH0309E: An error occurred while attempting to open the channel for endpoint 'jms:/queue?destination=Q_Daca_JMS#QM_mqtest&connectionFactory=binding(client)connectQueueManager(QM_mqtest)clientConnection(test.mq.com(1415))clientChannel(SYSTEM.DEF.SVRCONN)&initialContextFactory=com.ibm.mq.jms.Nojndi'
The operation could not be completed.
The endpoint may be down, unavailable, or unreachable, review the linked exception for further details.
Server stack trace:
at IBM.XMS.WCF.ExceptionHelper.ThrowCommsException(OperationType op, Exception innerException, String endpointURI)
at IBM.XMS.WCF.XmsOutputChannel.OnEndOpen(IAsyncResult result)
at IBM.XMS.WCF.XmsOutputChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade)
at System.ServiceModel.Channels.ServiceChannel.EnsureOpened(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 IMessage.ProcessMqMessage(String msg)
at N25Scan.EnqueueMessage(String message)
We cannot isolate what is causing the issue. We have tried to make modifications to the application to re-establish connections when this issue is encountered, but are still trying to figure out the cause.
When the app encounters this error all of the connections start failing / timing out so we had to ensure that all of the connections success or fail are properly disposing the WCF / Websphere MQ connections.
Any tips / info would be greatly appreciated. Cannot find anything help thus far searching the web.
Thanks,
S
We have a WinForms application (.NET 4.0/C#) that accesses several web services. We deployed to a client who has some proxy feature on their firewall (no proxy settings in Internet Options on the client machine, but it definitely IS a proxy).
The problem is, our WinForms app will fail on the first web service call. The error information isn't very useful but it's clear that it's unable to call the web service methods. The weird part is, once we put the web service (asmx) URL in Internet Explorer on that client machine, it works just fine for several days. It's as if IE is causing the router to cache some of the routing information.
Has anyone else experienced this? Is there a simple fix that we could implement?
Thank you!
Here is the Exception information:
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Net.WebException
Stack:
Server stack trace:
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at AutoUpdater.Module.WebService.AutoUpdaterWebService.AutoUpdater.ValidateInstallKey(String installKey, String computerIdentifier)
at AutoUpdater.Module.WebService.Config.ValidateInstallKey()
at AutoUpdater.Module.RemoteService.ValidateInstallKey()
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(System.Runtime.Remoting.Messaging.IMessage, System.Runtime.Remoting.Messaging.IMessage)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(System.Runtime.Remoting.Proxies.MessageData ByRef, Int32)
at AutoUpdater.Foundation.Interfaces.IRemoteService.ValidateInstallKey()
at AutoUpdater.UpdateForm..ctor()
at AutoUpdater.Program.Main()