I have WCF hosted SOAP service which I'm able to hit from the browser as well as from my SOAP client fine when making HTTP GET requests, however, when doing any HTTP POST requests, the response is a 404 Not Found.
My Web.config looks like:
<system.serviceModel>
<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" httpsGetEnabled="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="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" />
<bindings>
<wsHttpBinding>
<binding>
<security mode="Transport">
<transport clientCredentialType="Certificate" />
</security>
<readerQuotas maxDepth="15" maxStringContentLength="524288" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</binding>
</wsHttpBinding>
<basicHttpBinding>
<binding>
<readerQuotas maxDepth="15" maxStringContentLength="524288" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</binding>
</basicHttpBinding>
</bindings>
</system.serviceModel>
My service is defined in the markup using the .svc file as:
<%@ ServiceHost Language="C#" Debug="true" Service="Boca.WebServices.Billing.QBService" CodeBehind="QBService.svc.cs" %>
Again, I can hit my service using the browser and a SOAP client as follows using an HTTP GET but not with HTTP POST:
What am I doing wrong? Should I not be using the .svc markup and just define my service in the Web.config?
UPDATE:
When I "start debug" my WCF project from within VS 2010 using IIS Express on a localhost:8181 port, the HTTP POSTS to the service work. It's only when the service is hosted through IIS the HTTP POST to the service are being rejected or not found.
I've solved the problem. It, after all, was not an IIS issue rather an issue with the me not configuring the <basicHttpBinding>
with <security>
node. I din't thoroughly read about bindings and how they work, so I thought that adding the <wsHttpBinding>
alongside the <basicHttpBinding>
would add SSL support for WCF.
Doing so and configuring the default <wsHttpBinding>
with the <security>
node definitely allowed me to GET the SOAP metadata securely even though internally it was still using the <basicHttpBinding>
, however POSTs were not supported.
I updated my configuration so that the transport clientCredentialType
was set to None
and that resolved the issue:
<bindings>
<basicHttpBinding>
<binding name="QBService_BasicHttpBinding">
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
<readerQuotas maxDepth="15" maxStringContentLength="524288" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</binding>
</basicHttpBinding>
</bindings>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With