When I deploy my service to a test server I am getting the following error when I am trying to use it through a wcf test client (although it works under localhost):
Error: Cannot obtain Metadata from http://internal/RegisterService/RegisterService.svc If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange Error
The remote server returned an error: (415) Cannot process the message because the content type 'application/soap+xml; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'..HTTP GET Error
my web.config looks like this:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<etwTracking profileName="EndToEndMonitoring Tracking Profile"/>
</behavior>
<behavior name="wsSecureBehavior">
<serviceMetadata httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="false"/>
<protocolMapping>
<add scheme="http" binding="basicHttpBinding"/>
<add scheme="https" binding="wsHttpBinding"/>
</protocolMapping>
<diagnostics etwProviderId="830b12d1-bb5b-4887-aa3f-ab508fd4c8ba">
<endToEndTracing propagateActivity="true" messageFlowTracing="true"/>
</diagnostics>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IWcfService" closeTimeout="00:11:00" openTimeout="00:11:00" receiveTimeout="00:10:00" sendTimeout="00:11:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" 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>
<wsHttpBinding>
<binding name="wsHttp_IWcfService" maxBufferPoolSize ="2147483647" maxReceivedMessageSize="2147483647">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
<services>
<service name="Services.WCF.RegisterService" behaviorConfiguration="wsSecureBehavior" >
<endpoint address="secure" binding="wsHttpBinding" bindingConfiguration="wsHttp_IWcfService" name="registerServiceSecure" contract="Services.WCF.IRegisterService"/>
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IWcfService" name="RegisterService" contract="Services.WCF.IRegisterService"/>
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
</service>
</services>
</system.serviceModel>
Interface:
namespace Services.WCF
{
[ServiceContract]
public interface IRegisterService
{
...
}
}
Service
namespace Services.WCF
{
public class RegisterService : IRegisterService
{
....
}
}
I have had a look through many posts with the same error but cannot find a solution. I have tried the following:
I can browse to the url and it looks ok but I just can't access it through the test client and was wondering what else I may be missing
After more browsing through the many posts on this subject, I have come across this post: Error: Cannot obtain Metadata from http ......?wsdl and tried the option of including the remote server's self signed certificate and this seems to have solved the problem for me. Removing the bindings for the https also worked