locked
Getting WCF Service to work with https AND http RRS feed

  • Question

  • User195343576 posted

    Hello, I have a webservice configured for https connections that works great but I am looking to change the configure so that it also accepts stantard http calls but not sure how to configure the webconfig to accept both.

    ?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <system.web>
        <trace enabled="true" pageOutput="false" requestLimit="40" localOnly="false" />
        <customErrors mode="Off" />
        <compilation targetFramework="4.0">
          <assemblies>
            <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
          </assemblies>
        </compilation>
        <httpRuntime maxRequestLength="524288" />
        <authentication mode="Windows"></authentication>
      </system.web>
      <system.serviceModel>
        <behaviors>
          <serviceBehaviors>
            <behavior name="MyServiceTypeBehaviors">
              <serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" />
            </behavior>
          </serviceBehaviors>
          <endpointBehaviors>
            <behavior name="REST">
              <webHttp/>
            </behavior>
          </endpointBehaviors>
        </behaviors>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
        <services>
          <service name="ServiceApp.Service1" behaviorConfiguration="MyServiceTypeBehaviors">
            <endpoint address="" binding="webHttpBinding" behaviorConfiguration="REST" bindingConfiguration="webBinding" contract="ServiceApp.IService1" />
          </service>
        </services>
        <bindings>
          <webHttpBinding>
            <binding name="webBinding">
              <security mode="Transport">
                <transport clientCredentialType="Windows" />
              </security>
            </binding>
          </webHttpBinding>
        </bindings>
      </system.serviceModel>
      <system.webServer>
        <modules runAllManagedModulesForAllRequests="true" />
        <httpProtocol>
          <customHeaders>
            <add name="Access-Control-Allow-Origin" value="*" />
            <add name="Access-Control-Allow-Headers" value="Content-Type" />
          </customHeaders>
        </httpProtocol>
      </system.webServer>
    </configuration>

    Help would be much appreciated!

    Alex

    Monday, May 13, 2013 2:27 PM

Answers

All replies