I want to increase the MaxClockSkew of my binding but I don't know how can I convert my binding to a custom binding to add the MaxClockSkew element.
I really appreciate if anyone could help me converting this.
<wsHttpBinding>
<binding name="MyBinding" maxReceivedMessageSize="102400">
<readerQuotas maxArrayLength="51200" maxStringContentLength="102400" maxNameTableCharCount="2147483647" />
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="None" />
<message clientCredentialType="UserName" />
</security>
</binding>
</wsHttpBinding>
Thanks
Use the online WCF Binding Converter
Try this:
<customBinding>
<binding name="NewBinding0">
<security authenticationMode="UserNameOverTransport" messageSecurityVersion="WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10" />
<textMessageEncoding />
<httpsTransport maxBufferSize="102400" maxReceivedMessageSize="102400" />
</binding>
</customBinding>
Related
I have WCF hosted under website application at IIS. Below is service declarations in web.config
<system.serviceModel>
<services>
<service name="Emp.Depart.Handle">
<endpoint behaviorConfiguration="HandleBehavior" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IHandle"
contract="Emp.Depart.IHandle" />
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="HandleBehavior">
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="HandleBehaviors">
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IHandle" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
transferMode="Buffered" 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>
</bindings>
</system.serviceModel>
Despite of the previous declarations i got the error :
WCF The remote server returned an unexpected response: (400) Bad Request
when trying to connect from client, cofig of client is as follows :
<basicHttpBinding>
<binding name="BasicHttpBinding_Ihl7" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:05:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483646" maxBufferPoolSize="2147483646" maxReceivedMessageSize="2147483646"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="2147483646" maxStringContentLength="2147483646" maxArrayLength="2147483646"
maxBytesPerRead="2147483646" maxNameTableCharCount="2147483646" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
I can't identify the cause of the problem, i searched and increased maxRecievedMessage but nothing happened.
Please advice.
not nice and also strange way, but removing the name of the configuration may work bases on: WCF service maxReceivedMessageSize basicHttpBinding issue
also these could be useful:
how to increase MaxReceivedMessageSize when calling a WCF from C#
http://msdn.microsoft.com/en-us/library/ee358768.aspx/
I have tried lot but no success,
I have changed readerQuotas maxStringContentLength to 2147483647 of both my WinForms as well as WCF config files but still maxStringContentLength is set to 8192.
Can any body tell me how to change it and where to change, on WinForms or WCF service.
Client side Config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="ConnectWiseEntities" connectionString="data source=deepak;initial catalog=ConnectWise;persist security info=True;user id=sa;password=weexcel;" providerName="System.Data.EntityClient" />
</connectionStrings>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
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>
</bindings>
<client>
<endpoint address="http://localhost:50841/SyncFile(WCF2)/Service.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService"
contract="SynWebService.IService" name="BasicHttpBinding_IService" />
</client>
</system.serviceModel>
</configuration>
WCF Web.config
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
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>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
Your client config seems ok, modifiy your service config and add the corresponding behavior to the service as below.
You need to correctly setup the binding and behavior.Right click your web config and select edit WCF configuration.
for example,
<bindings>
<basicHttpBinding>
<binding name="defaultBinding">
<readerQuotas maxStringContentLength="1048576" />
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="Service1">
<endpoint address="http://localhost:56529/Service1.svc"
binding="basicHttpBinding" bindingConfiguration="defaultBinding"
contract="IWebExtractServiceIWebExtractService">
</endpoint>
</service>
</services>
You have defined the binding configuration in your service's web config, but you never tell the service to use it, so the default values for basicHttpBinding are used.
In WCF 4.0+, you have two ways to do this (Sajeethran gave one).
You can define a configuration for a binding and set it as the default configuration for the service by omitting the name attribute on the binding configuration, like this:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false"
hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647" messageEncoding="Text"
textEncoding="utf-8" transferMode="Buffered"
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>
</bindings>
Since the name attribute is ommitted, any services that are using this config will use the above binding configuration for the default for requests coming over the http protocol, unless overridden in a specific endpoint element's bindingCongifuration attribute.
The second way is to define an endpoint explicitly and assign the bindingCongifuration attribute the name of the binding configuration you've defined (again as shown in Sajeetharan's answer).
I went through all the posts about this, nothing helped, so I posted this because I'm pulling my hair out.
I have a WCF web-service that has a method that receives a string, a long string. It works with a string of 2,390,158 characters (tried it) but won't work with a string of about 5,440,519 characters. (I'm using VS 2010)
I have this error:
System.ServiceModel.CommunicationException: An error occurred while receiving the HTTP response http:// localhost : 58014/ WSWebService.asmx. The reason may be that the connection endpoint service does not use the HTTP protocol. This may also be due to a HTTP request context has been ignored by the server (possibly due to the discontinuation of service).
I put all parameters I could at int.MaxValue (2,147,483,647) but it still won't work. Any help/suggestion is gladly appreciated.
I removed the "timeout" parts but it makes no difference :
closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
Here's the binding in my app.config:
<bindings>
<basicHttpBinding>
<binding name="WSWebServiceSoap" maxReceivedMessageSize="20971520"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
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>
</bindings>
My config server side is :
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="WSWebServiceSoap" maxReceivedMessageSize="20971520"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
maxBufferSize="20971520" maxBufferPoolSize="20971520"
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>
</bindings>
</system.serviceModel>
So yes, same configuration. Am I missing something?
Service was ASMX based, redone it pure WCF and now it works.
WCF Streaming transfer mode hosted on IIS and trying to send 2 MB file from a console application but it fails with this error. It works on 3 different servers and NOT one prod server where as all three share the same information.
Is it anything related to SSL on IIS ? what might be problem ?
how to set UploadReadAheadSize Metabase Property in IIS 7.0 ?
IIS 7
Windows Server 2008 64 bit
Client:
<basicHttpBinding>
<binding name="BasicHttpBinding_IFileStreamingService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:05:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Mtom" textEncoding="utf-8" transferMode="Streamed"
useDefaultWebProxy="true">
<readerQuotas maxDepth="128" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
Service:
<basicHttpBinding>
<binding name="HttpStreaming" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" transferMode="Streamed" messageEncoding="Mtom">
<readerQuotas maxDepth="128" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
<!--<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>-->
<security mode="TransportWithMessageCredential">
<message clientCredentialType="UserName"/>
</security>
</binding>
</basicHttpBinding>
I'm using WindowsAuthentication in my silverlight application
Here is the setting that I have done in web.config
<authentication mode="Windows"/>
<basicHttpBinding>
<binding name="ServiceBinding" maxBufferSize="2147483647" maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647">
<readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Ntlm" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
it's working fine ,but when ever i run fiddler, the application asks for the username and password! Does any one knows what is the reason behind that.
Thank you,
Naseem
In fiddler beta 2, there is a option "use proxy credentials".
Or you can customize the fiddler rule for your development server using:
if (oSession.HostnameIs("www.example.com")){
oSession.bypassGateway = true;
}
here is the link how to do it:
http://www.fiddler2.com/fiddler/dev/scriptsamples.asp