0

I have applied ssl to my domain, but after that my wcf stopped working. I tried to add mexhttpsmapping but it not worked for me.

I am using wcf to fetch data in json format. My web.config:

<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="false" 
multipleSiteBindingsEnabled="true" />
<bindings>
  <webHttpBinding>
    <binding name="restLargeBinding" maxBufferPoolSize="2147483647" 
maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" 
transferMode="Streamed">
      <readerQuotas maxStringContentLength="2147483647"/>
    </binding>
  </webHttpBinding>
</bindings>
<behaviors>
  <endpointBehaviors>
    <behavior name="myWebEndPointBehaviour">
      <webHttp automaticFormatSelectionEnabled="true" 
defaultBodyStyle="Bare" defaultOutgoingResponseFormat="Json" 
helpEnabled="true"/>
      <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
    </behavior>
  </endpointBehaviors>
  <serviceBehaviors>
    <behavior name="myServiceBehaviour">
      <serviceMetadata httpGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="true"/>
      <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<services>
  <service name="DemoWCFServiceForVision.Service1" 
behaviorConfiguration="myServiceBehaviour">
    <endpoint address="" contract="DemoWCFServiceForVision.IService1" 
binding="webHttpBinding" bindingConfiguration="restLargeBinding" 
behaviorConfiguration="myWebEndPointBehaviour"/>
    <endpoint address="mex" contract="DemoWCFServiceForVision.IService1" 
binding="mexHttpBinding"/>
  </service>
</services>
<protocolMapping>
  <add binding="basicHttpBinding" scheme="https"/>
</protocolMapping>
</system.serviceModel>
<system.webServer>

 <rewrite>
    <rules>
        <rule name="HTTP to HTTPS redirect" stopProcessing="true"> 
            <match url="(.*)" /> 
            <conditions> 
                <add input="{HTTPS}" pattern="off" ignoreCase="true" />
            </conditions> 
            <action type="Redirect" redirectType="Permanent" 
url="https://{HTTP_HOST}/{R:1}" />
        </rule>   
    </rules>
</rewrite>

<modules runAllManagedModulesForAllRequests="true"/>
<directoryBrowse enabled="true"/>
</system.webServer>
Roman Pokrovskij
  • 9,449
  • 21
  • 87
  • 142

1 Answers1

0

you need to configure transport layer security and https service endpoint on webhttpbinding. You could refer to the example in the below reply.
WCF Service not hitting from postman over https
Feel free to let me know if there is anything I can help with.

Abraham Qian
  • 7,117
  • 1
  • 8
  • 22