Why is there a long delay between WCF TransportReceive and ServiceLevelReceiveReply? - c#

I have two environments running the same WCF web service but one of them seems to have a 3-5 minute delay returning the XML data. The slow down seems to occur in relation to the size of the data being returned. The web service just retrieves an XML string from a database so the processing time is constant.
The endpoint bindings are the same for both but I'm wondering what else would cause a delay.
I ran a trace and it shows that the TransportReceive happens at the same time on both environments, but on the delayed environment the ServiceLevelReceiveReply occurs after 3-5 minutes.
Any idea what could cause this? I'm happy to provide as much data as possible.
Here are the two bindings that are used. MyPolicySoap is used for getting the XML.
<basicHttpBinding>
<binding name="MyPolicySoap" closeTimeout="00:11:00" openTimeout="00:11:00" receiveTimeout="00:10:00" sendTimeout="00:11:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="5000000" maxBufferPoolSize="524288" maxReceivedMessageSize="5000000" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="5000000" maxArrayLength="16384" maxBytesPerRead="5000000" maxNameTableCharCount="16384"/>
<security mode="None">
<transport clientCredentialType="Windows" proxyCredentialType="None" realm=""/>
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
<wsHttpBinding>
<binding name="MyConfig" maxReceivedMessageSize="2147483647">
<readerQuotas maxStringContentLength="2147483647"/>
<security mode="None">
<transport clientCredentialType="Windows" proxyCredentialType="None" realm=""><!--<extendedProtectionPolicy policyEnforcement="Never" />--></transport>
<message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" establishSecurityContext="true"/>
</security>
</binding>
</wshttpbinding>

Related

No endpoint listening on transfering large file (app config)

In the below code i place appconfig when i upload large file it throws no endpoint listening.If the file size is small it works fine.Pls help me to rectify the issue.
<binding name="BasicHttpBinding_IFileTransfer" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
textEncoding="utf-8" useDefaultWebProxy="true" messageEncoding="Text">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>

How do i call webservice from windows service

I have a windows service from which I am trying to call a method under remote webservice but I am getting error that "Could not find default endpoint element that references contract 'MyWebService.BookingCitySoap' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element."
Following is the code for that
.cs File
MyWebService.BookingCitySoapClient ws = new MyWebService.BookingCitySoapClient();
ws.CallBookStatus();
ws.CallCanStatus();
App.config
<bindings>
<basicHttpBinding>
<binding name="BookingCitySoap" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:51317/Web/BookingCity.asmx"
binding="basicHttpBinding" bindingConfiguration="BookingCitySoap"
contract="MyWebService.BookingCitySoap" name="BookingCitySoap" />
</client>

Content type mismatch when consuming java wsdl from .net

There is a wsdl hosted on apache or jboss on a remote server that I am trying to use in my c# project. I have added a service reference in visual studio, which automatically generated an app.config file for me, where the system.serviceModel section looks as follows
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="ArtesiaWebServicesHttpBinding" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="655360" maxBufferPoolSize="524288" maxReceivedMessageSize="655360"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://serverpath/ArtesiaWebServices"
binding="basicHttpBinding" bindingConfiguration="ArtesiaWebServicesHttpBinding"
contract="DAMService.ArtesiaWebServicesInterface" name="ArtesiaWebServicesHttpPort" />
</client>
</system.serviceModel>
At runtime, during a method call, I get the following error:
The content type multipart/related; type="application/xop+xml"; start=""; start-info="text/xml"; boundary="----=_Part_386_1206794365.1374255761229" of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly.
What could be the problem?
The problem was solved by changing messageEncoding property of the binding to "Mtom" instead of "Text"

WCF Timeout Crash

If I use this code:
//in this timeout code necessary?
ServiceClient.Timeout = 10;
ServiceClient.GetRestaurantsByNameAsync (MenuFinderApp.RestaurantSearchName);
ServiceClient.GetRestaurantsByNameCompleted += delegate(object sender, GetRestaurantsByNameCompletedEventArgs args) {
//code to show records
};
I return several records. If I wait about 5 - 10 minutes and execute the code again, I receive a timeout error. Why does this happen and how can I keep the connection open? Must I specify a timeout for 60 minutes? Here is my Web.config for the WCF Service:
<binding name="BasicHttpBinding_IMenuFinderAppService" closeTimeout="infinite" openTimeout="infinite" receiveTimeout="infinite" sendTimeout="infinite" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="500000" maxBufferPoolSize="524288" maxReceivedMessageSize="500000" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="500000" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>

Web Service Creating Instance Problem -> Could not find default endpoint element that references contract 'MyWebService.ClassName'

i want to use the below Web-Service :
https://acquirer.sb24.com/ref-payment/ws/ReferencePayment?WSDL
and builded config file after adding ->
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="PaymentIFBinding" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
<binding name="PaymentIFBinding1" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://acquirer.sb24.com:443/ref-payment/ws/ReferencePayment"
binding="basicHttpBinding" bindingConfiguration="PaymentIFBinding"
contract="SB24Service.PaymentIF" name="PaymentIFPort" />
</client>
</system.serviceModel>
</configuration>
i want to call verifyTransaction method of this WebService :
PaymentIFClient pic = new PaymentIFClient();
double pic_result = pic.verifyTransaction(str1, str2);
but the first line throws the below error :
Could not find default endpoint element that references contract
'SB24Service.PaymentIF' in the ServiceModel client configuration
section. This might be because no configuration file was found for
your application, or because no endpoint element matching this
contract could be found in the client element.
EDIT :
"This error can arise if you are calling the service in a class
library and calling the class library from another project." -> My
Situation is like this ...
what should i change i configuration file ?
thanks in advance
Editing wcf configuration by hand is tricky, as there are many sections that need to be correct and correctly reference each other. Try opening your app.config file in SvcConfigEditor (also available from the Tools menu in Viusal Studio). It is way easier to get things correct when having GUI help on what to do.

Categories