I have a behavior exposed as REST API from my Graphite project. The API gives a "404" response code when I try it out over HTTPS site. The same API would respond back with valid data over HTTP site.
Am I missing any security settings in configuration?

asked 15 Jul, 10:14

Nitin%20Chhabra's gravatar image

Nitin Chhabra
86222328
accept rate: 40%


I figured it out with the help of platform developer.

When you are trying to access the REST API over HTTPS site, there are a couple of updates/additions that need to be made in web.config of your website that's SSL enabled versus the one that's not SSL enabled.

  1. Under section <swaggerwcf></swaggerwcf>, make sure everything all the $$$ entries are set according to your project
    <settings>
    <setting name="InfoDescription" value="$$$Description$$$"/>
    <setting name="InfoVersion" value="1.0"/>
    <setting name="InfoTermsOfService" value="$$$TermsOfService$$$"/>
    <setting name="InfoTitle" value="$$$ProjectTitle$$$"/>
    <setting name="InfoContactName" value="$$$DeveloperName$$$"/>
    <setting name="InfoContactUrl" value="$$$WebsiteURL$$$"/>
    <setting name="InfoContactEmail" value="$$$DeveloperEmail$$$"/>
    <setting name="InfoLicenseUrl" value="http://www.apache.org/licenses/LICENSE-2.0.html"/>
    <setting name="InfoLicenseName" value="Apache 2.0"/>
    <setting name="Host" value="$$$yourwebsite.com$$$"/>
    <setting name="BasePath" value="/rest"/>
    <setting name="Schemes" value="https"/>
    </settings>
  2. Under section <bindings></bindings>, compare and update the binding
    <webhttpbinding>
    <binding name="restWebHttpBinding" contenttypemapper="EnrollmentPortal.Service.RawWebContentTypeMapper, HollyAdams.EnrollmentPortal-Project, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
    <security mode="Transport"/>
    </binding>

    </webhttpbinding>
  3. Under section <servicebehaviors></servicebehaviors>, compare and update behaviors
    <behavior>
    <servicemetadata httpsgetenabled="True"/>
    <servicedebug includeexceptiondetailinfaults="False"/>
    </behavior>
    <behavior name="GTCServiceBehavior">
    <servicemetadata httpsgetenabled="true"/>
    <wcfmessageinspection/>
    <servicedebug includeexceptiondetailinfaults="False"/>
    </behavior>
  4. Add new section (below section <extensions></extensions>)
    <protocolmapping>
    <add scheme="http" binding="webHttpBinding" bindingconfiguration="restWebHttpBinding"/>
    <add scheme="https" binding="webHttpBinding" bindingconfiguration="restWebHttpBinding"/>
    </protocolmapping>

Once the above changes are done, perform IIS reset and test the api again.

link

answered 15 Jul, 11:34

Nitin%20Chhabra's gravatar image

Nitin Chhabra
86222328
accept rate: 40%

edited 15 Jul, 11:55

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×8
×1
×1

Asked: 15 Jul, 10:14

Seen: 323 times

Last updated: 15 Jul, 11:55

Powered By:   Graphite