WCF service failing to carry large array of from DAL to MVC - c#

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.

Related

WCF service fails on IIS 10 on Server 2019

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.

Connecting to Charge point with the use of charge point wsdl from Central System

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.

InvalidOperationException when calling asmx web service

I have a windows application (actually an Outlook addin) that calls an asmx web service (yes, it's legacy, but the company is reluctant to move away from it & re-develop everything...) to get some data. The return value is a DataTable. I am calling the web service by adding is as a web service reference.
This has been working correctly for all clients, but recently one client reported an issue where calling the web service throws the following errors (on two separate calls):
Exception Type: InvalidOperationException
Exception Message: There is an error in XML document (23, 93530).
Inner Ex Type: IOException
Inner Ex Message: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
StackTrace: at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle)
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
Exception Type: InvalidOperationException
Exception Message: There is an error in XML document (4426, 32).
Inner Ex Type: IOException
Inner Ex Message: The operation has timed out.
StackTrace: at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle)
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
I am able to rule out that my application is generating the timeout as I am setting the web service class' TimeOut property to 2hrs before the call, and the next request has come through to the server in about 20-30 minutes.
Going through the IIS log, all the requests that have failed for the client have a http status of 200, but also a win32-status of 995.
I have been trying to replicate this error and get the reason why it is occurring without any success for the better part of the last 3 days (I need to find the exact reason - company policy :( :P). I need to know why this occurs and what is the solution or best work-around for this issue.
I have also posted this on the MSDN forum here
Can anyone help me with this? Any help is greatly appreciated. Thanks!
Cheers!
you need to check to see if your hitting a connection limit ask the servers closing it
as the other party to check web.config
<system.net>
<connectionManagement>
<add address="*" maxconnection="40"/>
</connectionManagement>
</system.net>

Communication Exception with my WCF Service SL4 app

Sorry if the Title is a little vague but the truth is I do not understand my problem, I have never come across this before and I havent done anything out of the Ordinary.
Right I have a basic Silverlight 4 Application using the Business Application Template. I have also created a WCF Service Application Project which is used to simply return an Observable collection for some entries in my Database,
I published this to my Local computer which I then referenced in my SL4 app and I get this exception
[System.ServiceModel.CommunicationException: The remote server returned an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound.
at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass5. <EndGetResponse>b__4(Object sendState)
at System.Net.Browser.AsyncHelper.<>c__DisplayClass4.<BeginOnUI>b__0(Object sendState)
--- End of inner exception stack trace ---
at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest. CompleteGetResponse(IAsyncResult result)
--- End of inner exception stack trace ---
at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
at System.ServiceModel.ClientBase`1.ChannelBase`1.EndInvoke(String methodName, Object[] args, IAsyncResult result)
at RMServiceRIA.rService.Service1Client.Service1ClientChannel.EndgetBuildings(IAsyncResult result)
at RMServiceRIA.rService.Service1Client.RMServiceRIA.rService.IService1.EndgetBuildings(IAsync Result result)
at RMServiceRIA.rService.Service1Client.OnEndgetBuildings(IAsyncResult result)
at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)}
I have got a clientaccess policy and crossdomain policy which for the purpose of testing is set to allow anything access,
Client Access Policy
Cross Domain
any ideas on how to fix this problem, I debugged my WCF Service and it receives the call, the method executed reaches its return statement, yet my SL4 never even receives the result, as soon as my WCF service has the result I get an exception thrown within my SL4 app, to me it just seems that the connection gets closed but I dont know and I have tried to research but where do you start with something you dont fully understand? I found many people with the same sort of error message but WCF is so damn cryptic... I did try and enable the debugging information inside of my webconfig. I have also tried to host the WCF service on my Web server but no luck, I have several WCF Services running on that with a similar set up so I am unsure why this isnt working
Web Config for WCF Service
client config
Thanks for having a look, and if you need any more info just ask I'll be happy to provide you with it,
Your best bet is to turn on WCF Tracing so you can see what is going on.
http://software.intel.com/en-us/blogs/2010/02/03/adventures-with-silverlight-and-wcf-the-remote-server-returned-an-error-notfound/
Most likely there is an issue with serializing something. Not found is just the Silverlight version of a 500 error.

WCF service access from client application when user is behind proxy

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

Categories