In my service I need to set keepAliveEnable=false in order to work with my load balancer. Therefore I followed instruction in this article. I did same thing mentioned in article but I am getting this error.
<customBinding>
<binding name="HttpBinding" keepAliveEnabled="False"/>
</customBinding>
The Scheme cannot be computed for this binding because this CustomBinding lacks a TransportBindingElement. Every binding must have at least one binding element that derives from TransportBindingElement.
Then I found set keepAliveFalse like below
<customBinding>
<binding name="HttpBinding" >
<textMessageEncoding />
<httpTransport allowCookies="false" keepAliveEnabled="false"/>
</binding>
</customBinding>
In this method service is getting started normal and I can get the responses. But in request headers still shows connection as keep alive. (I checked using firebug)
What is the correct way of doing this?
What is the end I need to set keep alive false (client or service) ?
Am I checking keepAlive in wrong way?
Related
I try to connect to the NetSuite OpenAir API from a .NET console application using a WCF client. I generated the proxy by adding a service connection and using the following WSDL: http://sandbox.openair.com/wsdl.pl?wsdl&style=document
Logging in and reading data works fine as long as the HTTP response does not exceed a specific size. When that happens a System.IO.InvalidDataException occurs. The exception message is "Block length does not match with its complement".
These are the exception details:
System.IO.InvalidDataException
HResult=0x80131501
Message=Block length does not match with its complement.
Source=mscorlib
StackTrace:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at TestService.OASandbox.OAirServiceHandler.read(readRequest1 request)
at TestService.OASandbox.OAirServiceHandlerClient.TestService.OASandbox.OAirServiceHandler.read(readRequest1 request) in TestService\Connected Services\OASandbox\Reference.cs:line 43089
at TestService.OASandbox.OAirServiceHandlerClient.read(SessionHeader SessionHeader, ReadRequest[] method) in TestService\Connected Services\OASandbox\Reference.cs:line 43096
at TestService.Program.Main() in TestService\Program.cs:line 105
I used Fiddler to find out what the turning point is. It appears that the exception is raised when the Content-Length of the HTTP response is larger than 10000 bytes. The response itself is completely intact: when I analyze it using Fiddler it can be deciphered (as it is a SSL connection) and the full XML which is sent back by OpenAir is revealed. So it has to be a problem with the .NET code.
The WCF bindings are defined in my app.config as follows:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="OAirServiceSoapBinding" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647">
<security mode="Transport" />
<readerQuotas maxDepth="200" maxStringContentLength="83886089" maxArrayLength="163841" maxBytesPerRead="2147483647" maxNameTableCharCount="16384"/>
</binding>
<binding name="OAirServiceSoapBinding1" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647">
<readerQuotas maxDepth="200" maxStringContentLength="83886089" maxArrayLength="163841" maxBytesPerRead="2147483647" maxNameTableCharCount="16384"/>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://sandbox.openair.com/soapdoc" binding="basicHttpBinding"
bindingConfiguration="OAirServiceSoapBinding" contract="OASandbox.OAirServiceHandler"
name="OAirService" />
</client>
</system.serviceModel>
Looking at the exception it appears that it has something to do with the DEFLATE decompression algorithm, which is internally being called by WCF. It seems like some buffer overflow occurs. I could define a custom binding and disable compression, but I would like to keep that as a last resort.
Any clues how to troubleshoot this issue? Any help is highly appreciated!
I am using the NetSuite SuiteTalk WSDL. I add this as a web reference and it is then added as a setting to "applicationSettings" in my config file:
I think the problem is that your binding to the SOAP service only allows for a certain size of data to be returned. If the WSDL is added as a web reference, this restriction should not apply. I added mine as follows:
1) Right click on "References" in your WCF service and select "Add Service Reference".
2) Select "Advanced":
3) Add web reference:
4) Paste your WSDL reference and click on the arrow next to the text field. Wait for the WSDL to appear in the text block and click "add reference".:
I hope this helps!
I'm currently trying to consume a SOAP 1.2 web service using a WCF client. Problem is, whenever I make a request a MessageSecurityException with the following inner message is thrown:
SOAP header Security was not understood
From what I can tell, the WS does not understand the Security header, which is currently marked as MustUnderstand="true".
How can I change MustUnderstandto false / remove the Security header?
Below is the binding I'm using right now:
<customBinding>
<binding name="CteRecepcaoSoap12">
<textMessageEncoding messageVersion="Soap12" />
<security authenticationMode="CertificateOverTransport"/>
<httpsTransport requireClientCertificate="true"/>
</binding>
</customBinding>
I need to create a WCF service that gets some data out of a database. This service should only be accessible at night, for some reason. I have been told this should be possible by some code in web.config, but I have no idea how.
Not sure if there's a way to define in web.config, but it seems like you can use PowerShell to schedule and terminate the service.
MSDN blog post on scheduling background jobs
It's not possible in web.config. This is a highly unusual requirement. Certainly not built in.
Just go like this:
if (DateTime.Now.Hour >= 22)
throw new FaultException("ServiceUnavailable");
For a client, you would want to adjust the sendTimeout attribute of a binding element. For a service, you would want to adjust the receiveTimeout attribute of a binding elemnent.
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="longTimeoutBinding"
receiveTimeout="00:10:00" sendTimeout="00:10:00">
<security mode="None"/>
</binding>
</netTcpBinding>
</bindings>
<services>
<service name="longTimeoutService"
behaviorConfiguration="longTimeoutBehavior">
<endpoint address="net.tcp://localhost/longtimeout/"
binding="netTcpBinding" bindingConfiguration="longTimeoutBinding" />
</service>
Let me know if this answers your question.
I created a simple WCF service with netHttp binding, and then automatically added service references from it into another application via "Add service reference|Discover". The resulting binding looks weird.
Instead of the original NetHttpBinding I get a CustomBinding.
It works, but annoyingly I can't add a maxReceivedMessageSize to a custom binding.
Question: Is there any good reason for this, or can I safely replace the custom binding with the original netHttpBinding?
The host's app.config:
<endpoint address="images/netbh" binding="netHttpBinding" contract="WcfImageService.IImageService" bindingConfiguration="netHttp_bh" />
<netHttpBinding>
<binding name="netHttp_bh" messageEncoding="Binary">
<webSocketSettings transportUsage="Never"/>
</binding>
</netHttpBinding>
The client's generated app.config:
<customBinding>
<binding name="NetHttpBinding_IImageService1" >
<binaryMessageEncoding />
<httpTransport />
</binding>
</customBinding>
<endpoint address="http://localhost:8080/images/netbh" binding="customBinding"
bindingConfiguration="NetHttpBinding_IImageService1" contract="ImageServiceReference.IImageService"
name="NetHttpBinding_IImageService1" />
I'm using Visual Studio 2015, in case that matters.
I don't know why you get a customBinding in the client (I think the wsdl.exe tool that Visual Studio uses behind the scenes is a bit confused) but you can safely replace the custom binding with the original webHttpBinding.
As an alternative, I think you can also specify can also specify maxReceivedMessageSize on the <httpTransport> element like this:
<httpTransport maxReceivedMessageSize="2000000000" />
I am getting the error of "The request channel timed out after 1 min" even sendTimeout="00:25:00" on both sides.
If request is less than 1 min in time, then there is no issue but issue arises on request taking processing of greater than 1 min. on WCF service.
On WCF service side I have following bindings in my web.config file
<bindings>
<basicHttpBinding>
<binding maxReceivedMessageSize="67108864" transferMode="Streamed" closeTimeout="00:25:00" openTimeout="00:25:00" sendTimeout="00:25:00" receiveTimeout="00:25:00" >
<security mode="None" ></security>
</binding>
</basicHttpBinding>
</bindings>
On Client side, I have following bindings in my app.config file
<bindings>
<basicHttpBinding>
<binding name="streambinding" maxReceivedMessageSize="67108864" closeTimeout="00:25:00" openTimeout="00:25:00" sendTimeout="00:25:00" receiveTimeout="00:25:00" transferMode="Streamed">
<security mode="None"></security>
</binding>
</basicHttpBinding>
</bindings>
Can you add trace and message logs (at client and service) and share the findings? refer this article for client and this for service
from your config file of service and client I could make out that, your service bindingconfiguration is default I mean it doesn't have any name given, but client side binding configuration has a binding name. Try to keep it same both at the service and client, either have a name for binding configuration in service or remove the name from the client. Since you are accessing with different bindingName WCF not able to recognize the exact configuration and it might be timing out.