I am using webHttpbinding configuration for WCF Rest service.
<webHttpBinding>
<binding name="RestBinding" closeTimeout="10:01:00" openTimeout="10:01:00" receiveTimeout="10:10:00" sendTimeout="10: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="TransportCredentialOnly">
<transport clientCredentialType="Windows" proxyCredentialType="None" realm=""/>
</security>
</binding>
</webHttpBinding>
And I have specified below endpointBehaviors
<extensions>
<behaviorExtensions>
<add name="customBehavior" type="XXX" />
</behaviorExtensions>
</extensions>
<behaviors>
<endpointBehaviors>
<behavior name="endpointBehaviour">
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
<customBehavior />
</behavior>
<behavior name="endpointBehaviourForRestService">
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
<customBehavior/>
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
How to consume this service at client side after hosting this in IIS?
Currently we are getting below error while trying to access this at client side by
string returnValue = webClient.UploadString("http://localhost:55107/Service1.svc/methodname", "POST", data);
Error:
System.Net.WebException occurred
HResult=0x80131509
Message=The remote server returned an error: (401) Unauthorized.
Also we are unable to add this as service reference in client project.
Please share your thoughts if any on this.