Asked by:
After deploying the WCF service on IIS under SSL, In svcutil.exe https is not comming

Question
-
User932454309 posted
Hi All,
I have deployed the WCF service on IIS under SSL. When, I access through browser its open properly, as below URL:
https://mysite/Staging/adms/AdmsService.svc.
BUt, on this page there is svcutill.exe url which shows without https:
svcutil.exe: http://mysite/Staging/adms/AdmsService.svc?wsdl
I have tried like: HttpsGetEnable=true
Also, When I do HttpGetEnable=false it shows the https with machine host name:
svcutil.exe https://hostname/Staging/adms/AdmsService.svc?wsdl
Also, https is not coming in targetNamespacespace:
--------------
<wsdl:types>
<xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import schemaLocation="http://mysite/Staging/adms/AdmsService.svc?xsd=xsd0" namespace="http://tempuri.org/"/>
<xsd:import schemaLocation="http://mysite/Staging/adms/AdmsService.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
<xsd:import schemaLocation="http://mysite/Staging/adms/AdmsService.svc?xsd=xsd2" namespace="http://schemas.datacontract.org/2004/07/ns_adms"/>
</xsd:schema>
</wsdl:types>-------------------
When try to add service reference its giving the following message.
There was an error downloading 'https://mysite/Staging/adms/AdmsService.svc/$metadata'.
The request failed with HTTP status 400: Bad Request.
Metadata contains a reference that cannot be resolved: 'https://mysite/Staging/adms/AdmsService.svc'.
Content Type application/soap+xml; charset=utf-8 was not supported by service https://mysite/Staging/adms/AdmsService.svc. The client and service bindings may be mismatched.
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'..
If the service is defined in the current solution, try building the solution and adding the service reference again.Kindly suggest.
It will be great help for me.
Saturday, June 3, 2017 11:35 PM
All replies
-
User991499041 posted
Hi sarveshc,
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'..Cause:
a. This is usually a mismatch in the client/server bindings, where the message version in the service uses SOAP 1.2 (which expects application/soap+xml) and the version in the client uses SOAP 1.1 (which sends text/xml). WSHttpBinding uses SOAP 1.2, BasicHttpBinding uses SOAP 1.1.
b. If there are some invaild markups in service's web.config, it will also raise this error.
Solutions:
Verify that the bindings used by the client/server are the same.
See http://social.technet.microsoft.com/wiki/contents/articles/hosting-a-wcf-rest-service-on-iis.aspx for more details. Specifically look at the web.config for the sample.
Regards,
zxj
Monday, June 5, 2017 3:05 AM -
User932454309 posted
Thanks for replying.
I have already tried but did not succeed.
As I per my finding: As service is installed on SSL then svcutil.exe URL should be https://youniverse.crisil.com/Staging/adms/AdmsService.svc?wsdl
But is it is coming without https:
svcutil.exe http://youniverse.crisil.com/Staging/adms/AdmsService.svc?wsdl
Thanks for your support.
Monday, June 5, 2017 5:03 PM -
User991499041 posted
Hi sarveshc,
As I per my finding: As service is installed on SSL then svcutil.exe URL should be https://youniverse.crisil.com/Staging/adms/AdmsService.svc?wsdl
But is it is coming without https:
svcutil.exe http://youniverse.crisil.com/Staging/adms/AdmsService.svc?wsdl
Thanks for your support.
There are two system-provided bindings available for exposing metadata endpoints: mexHttpBinding and mexHttpsBinding. mexHttpBinding is used to expose a metadata endpoint over HTTP in a non-secure manner. mexHttpsBinding is used to expose a metadata endpoint over HTTPS in a secure manner. You could try adding another endpoint 'mex' as below in web.config.
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
You can use your SSL certificate in the below steps, https://social.technet.microsoft.com/wiki/contents/articles/11510.wcf-iis-and-ssl.aspx.
Regards,
zxj
Tuesday, June 6, 2017 7:47 AM -
User-200361909 posted
Hi sarveshc,
Have u find the solution of this?
I am also getting the same issue.
Friday, March 1, 2019 7:06 PM