I have here a WCF Duplex Service, the requierement is that the Callback to the client should have a timeout of 10 seconds, therefor my web.config file of the Service looks like this:
<bindings>
<basicHttpBinding>
<binding name="simulatorEndpoint" closeTimeout="00:00:10" openTimeout="00:00:10"
receiveTimeout="00:00:10" sendTimeout="00:00:10" 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>
<wsDualHttpBinding>
<binding name="wsdualEndpoint" closeTimeout="00:00:10" openTimeout="00:00:10"
receiveTimeout="00:00:10" sendTimeout="00:00:10" bypassProxyOnLocal="false"
transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536" clientBaseAddress="http://localhost:1235"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:00:10" />
<security mode="Message">
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
</wsDualHttpBinding>
</bindings>
on the client side the bindings in the app.config file are the same with the same timeout values.
The effects are now that if the client sends a request to the server the Timeout is 10seconds. But on the other side if the service sends a callback to the client the timeout is 1minute. Thats very strange...obviously the timeout is correctly set on the client side..but not on the service...How can i change the timeout on the service?
PS: I am using Visual Studio 2010 and the debug mode of it with the approbiate ASP.NET Development Server 10.0.0.0
Brief summary of binding timeouts...
Client side:
SendTimeout is used to initialize the OperationTimeout, which governs the whole interaction for sending a message (including
receiving a reply message in a request-reply case). This timeout also
applies when sending reply messages from a CallbackContract method.
OpenTimeout and CloseTimeout are used when opening and closing channels (when no explicit timeout value is passed).
ReceiveTimeout is not used.
Server side:
Send, Open, and Close Timeout same as on client (for Callbacks).
ReceiveTimeout is used by ServiceFramework layer to initialize the session-idle timeout.
[edit: some code]
Also try adding this to your service config
<behaviors>
<endpointBehaviors>
<behavior name="MyCallbackBehavior">
<callbackTimeouts transactionTimeout="00:00:10"/>
</behavior>
</endpointBehaviors>
<behaviors>
then add the behavior to your endpoint
<endpoint behaviorConfiguration="MyCallbackBehavior" />
Ok i found the mistake...
i did the bindingConfiguration right with
<wsDualHttpBinding>
<binding name="wsdualEndpoint" closeTimeout="00:00:10" openTimeout="00:00:10"
receiveTimeout="00:00:10" sendTimeout="00:00:10" bypassProxyOnLocal="false"
transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536" clientBaseAddress="http://localhost:1235"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:00:10" />
<security mode="Message">
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
</wsDualHttpBinding>
but the clue was that this was my declaration of the endpoint:
<endpoint address="dual" binding="wsDualHttpBinding"
name="wsdualEndpoint" contract="INotificationService"/>
because my assumption was that he would fetch the above defined binding-configurations and use them for my endpoint, but that was wrong, i have to add bindingConfiguration="THE NAME of THE CONFIGURATION" to the endpoint-declaration.
Therefor, just for your information my working configuration looks like this:
<wsDualHttpBinding>
<binding name="MywsdualEndpoint" sendTimeout="00:00:05" bypassProxyOnLocal="false"
transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true"/>
<security mode="Message">
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
</wsDualHttpBinding>
and the correct endpoint declaration is:
<endpoint address="dual" binding="wsDualHttpBinding" bindingConfiguration="MywsdualEndpoint" contract="INotificationService"/>
Related
I have a WCF Service that is self hosted and started through another service. Debugging in visual studio, they work just fine until I add endpoint configurations to my app.config for the service clients. Some clients for this service will be local and others remote. I have tried only having client endpoints for named pipes, if there's a client endpoint pointing to the service, and a client using the endpoint (even though it shouldn't even be instantiated at the point the service tries to start) I get an exception telling me that 0.0.0.0:8524 is in use. Here's the relevant configuration:
<service name="EventService.EventPublishingService">
<clear />
<endpoint binding="netTcpBinding" address="net.tcp://localhost:8524/EventPublishingService" contract="EventService.Contracts.IEventPublishService">
</endpoint>
<endpoint address="net.tcp://localhost:8524/EventPublishingService/mex" binding="mexTcpBinding" contract="IMetadataExchange">
</endpoint>
<endpoint address="net.pipe://localhost/EventPublishingServicePipe"
binding="netNamedPipeBinding" contract="EventService.Contracts.IEventPublishService"
listenUriMode="Explicit">
</endpoint>
<host>
</host>
</service>
For client endpoints I have tried both
<endpoint address="net.tcp://localhost:8524/EventPublishingService"
binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IEventPublishService"
contract="AGX.Atlas.EventService.Contracts.IEventPublishService" name="NetTcpBinding_IEventPublishService">
</endpoint>
and
<endpoint address="net.pipe://localhost/EventPublishingServicePipe"
binding="netNamedPipeBinding" bindingConfiguration="NetNamedPipeBinding_IEventPublishService"
contract="AGX.Atlas.EventService.Contracts.IEventPublishService" name="NetNamedPipeBinding_IEventPublishService">
</endpoint>
I've removed the net.pipe binding from the service when removing the client binding as well to make sure it wasn't doing something weird with that. Still the same issue.
Here's the binding configurations:
<netNamedPipeBinding>
<binding name="NetNamedPipeBinding_IEventPublishService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288"
maxBufferSize="65536" maxConnections="10" maxReceivedMessageSize="65536">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="Transport">
<transport protectionLevel="EncryptAndSign" />
</security>
</binding>
</netNamedPipeBinding>
<netTcpBinding>
<binding name="NetTcpBinding_IEventPublishService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard" listenBacklog="10"
maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10"
maxReceivedMessageSize="65536">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Transport">
<transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
<message clientCredentialType="Windows" />
</security>
</binding>
<binding name="NetTcpBinding_IEventSubscriptionService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard" listenBacklog="10"
maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10"
maxReceivedMessageSize="65536">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Transport">
<transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
<message clientCredentialType="Windows" />
</security>
</binding>
</netTcpBinding>
i am trying to consuming wcf web service and got error
The identity check failed for the outgoing message. The expected identity is 'identity(http://schemas.xmlsoap.org/ws/2005/05/identity/right/possessproperty: http://schemas.xmlsoap.org/ws/2005/05/identity/claims/spn)' for the 'http://localhost/SCVMMService/VirtualMachineManagementService.svc' target endpoint.
for consuming webservice i am using code :
Client.ClientCredentials.Windows.ClientCredential.Domain = "testlab.ourcp.com";
Client.ClientCredentials.Windows.ClientCredential.UserName = "administrator";
Client.ClientCredentials.Windows.ClientCredential.Password = "M!ndMasT23";
Client.ClientCredentials.UserName.UserName = "administrator";
Client.ClientCredentials.UserName.Password = "M!ndMasT23";
Client.Open();
WebConfig:
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IVirtualMachineManagementService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/>
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None" realm=""/>
<message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost/SCVMMService/VirtualMachineManagementService.svc" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IVirtualMachineManagementService" contract="ServiceReference1.IVirtualMachineManagementService" name="WSHttpBinding_IVirtualMachineManagementService">
<identity>
<servicePrincipalName value="DDC-SC-VMM02.testlab.ourcp.com\Administrator"/>
</identity>
</endpoint>
</client>
and in webService config file for identity use:
<dns value="localhost"/>
Is the WCF service you're trying to access configured to use Service Identity? If not, remove the entire identity element from the endpoint element because it's only used with the Service Indentity feature.
I am trying to call WCF method from my MVC application. While calling the WCF method, I am getting the "The remote server returned an unexpected response: (400) Bad Request" error.
I am passing a list of items. if I am passing only 50, its going in, but if its morethan that, it is showing the error message.
Any help on this will be greatly appreciated.
My client config:
<basicHttpBinding>
<binding name="BasicHttpBinding_IPaymentRequestService"
closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00"
sendTimeout="00:10:00"
allowCookies="false" bypassProxyOnLocal="false"
hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" transferMode="StreamedRequest"
useDefaultWebProxy="true">
<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>
</basicHttpBinding>
Server Config:
<services>
<service name="BasicHttpBinding_IPaymentRequestService" >
<endpoint name="BasicEndpoint"
address="http://localhost/Intel.IIP.WCF.Hosting/PaymentRequestServiceHost.svc"
binding="basicHttpBinding" bindingConfiguration="ServiceBinding"
contract="IPaymentRequestService">
</endpoint>
</service>
</services>
<bindings>
<basicHttpBinding >
<binding name="ServiceBinding"
transferMode="StreamedRequest" allowCookies="false" useDefaultWebProxy="true"
messageEncoding="Text" hostNameComparisonMode="StrongWildcard"
bypassProxyOnLocal="false" maxBufferPoolSize="2147483647" textEncoding="utf-8"
closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00"
sendTimeout="00:10:00" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<readerQuotas
maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxDepth="2147483647" maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647"/>
<security mode="None" ></security>
</binding>
</basicHttpBinding>
</bindings>
Regards
Amal
Did you try:
<system.web>
<httpRuntime maxRequestLength="2097151" />
</system.web>
I am getting this error when i am sending more than 500 records to save.so please help me out this is my service
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IMFMReport" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="true" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="999999999"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
<client>
<endpoint address="http://localhost:3956/MFMReportService.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IMFMReport"
contract="MFMReportService.IMFMReport" name="WSHttpBinding_IMFMReport">
<identity>
<userPrincipalName value="pkshah#GESCO.COM" />
</identity>
</endpoint>
</client>
</system.serviceModel>
That is not your service, that is a client. If you want to pass large dataset to the service you must configure MaxReceivedMessageSize on the service - the word Received means that you are configuring message receiver.
Is there a way to expose a service from a single endpoint like "https://mydomain.com/Myservice.svc"
but to be able to have differents binding configuration.
I know that a endpoint must be unique on URL + Contract + Binding, but I wonder how can I have multiple bindings
without coping all the .svc files for every bindings that I whant to support (since a URL in IIS is a folder or a virtual directory)
In example, I want to have Http with encryption, Http without encryption.. If later I whant no securityContext to be established, than I have to copy 4 times my svc files to support
One with :
establishSecuriTyContext = true
Encryption = true
One with :
establishSecuriTyContext = true
Encryption = false
One with :
establishSecuriTyContext = true
Encryption = true
One with :
establishSecuriTyContext = false
Encryption = false
and so on....
It don't makes sense to me.
Reference a unique binding configuration for each endpoint. This example shows how to do it with the NetNamedPipeBinding, but you can extend the concept to other bindings as well.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<netNamedPipeBinding>
<binding name="default1" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" transactionFlow="false"
transferMode="Buffered" transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288"
maxBufferSize="65536" maxConnections="10" maxReceivedMessageSize="65536">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="Transport">
<transport protectionLevel="EncryptAndSign" />
</security>
</binding>
<binding name="default2" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="infinite" sendTimeout="00:01:00" transactionFlow="false"
transferMode="Buffered" transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288"
maxBufferSize="65536" maxConnections="10" maxReceivedMessageSize="65536">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="Transport">
<transport protectionLevel="EncryptAndSign" />
</security>
</binding>
</netNamedPipeBinding>
</bindings>
<services>
<service name="MyService">
<endpoint name="MyService1"
address="net.pipe://localhost/MyService1"
contract="NSITE.Services.Event.IMyService"
binding="netNamedPipeBinding" bindingConfiguration="default1" />
<endpoint name="MyService2"
address="net.pipe://localhost/MyService2"
contract="NSITE.Services.Event.IMyService"
binding="netNamedPipeBinding" bindingConfiguration="default2" />
</service>
</services>
</system.serviceModel>
</configuration>