locked
webservice WCF with SSL error 400 bad request RRS feed

  • Question

  • User195343576 posted

    I have a WCF webservice thats used to work over regular http. I just recently got a valid certificate from godday installed the certifcate now if i access the service.svc with the browser everything looks good but now what ever function i try to call gives me a 400 bad request :*( help!

    here is my web.config

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <system.web>
          <customErrors mode="Off"/>
        <compilation debug="true" 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="None"></authentication>
      </system.web>
      <system.serviceModel>
    
          <services>
              <service name="ServiceApp.Service1" behaviorConfiguration="ServiceBehaviour">
                  <endpoint address=""
                            binding="basicHttpBinding"
                            bindingConfiguration="secureHttpBinding"
                            contract="ServiceApp.IService1"/>
    
                  <endpoint address="mex"
                            binding="mexHttpsBinding"
                            contract="ServiceApp.IService1" />
              </service>
          </services>
    
    
          <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" />
        <standardEndpoints>
          <webScriptEndpoint>
            <standardEndpoint name="" crossDomainScriptAccessEnabled="true" />
          </webScriptEndpoint>
        </standardEndpoints>
        <bindings>
          <!--<webHttpBinding>
            <binding name="StreamedRequestWebBinding" bypassProxyOnLocal="true" useDefaultWebProxy="false" hostNameComparisonMode="WeakWildcard" sendTimeout="10:15:00" openTimeout="10:15:00" receiveTimeout="10:15:00" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" transferMode="StreamedRequest">
              <readerQuotas maxArrayLength="2147483647" maxStringContentLength="2147483647" />
            </binding>
          </webHttpBinding>-->
            <basicHttpBinding>
                <binding name="secureHttpBinding">
                    <security mode="Transport">
                        <transport clientCredentialType="None"/>
                    </security>
                </binding>
            </basicHttpBinding>
        </bindings>
        
        <behaviors>
          <serviceBehaviors>
            <behavior name="ServiceBehaviour">
              <serviceMetadata httpGetEnabled="false" httpsGetEnabled="True" />
              <serviceDebug includeExceptionDetailInFaults="false"  />
            </behavior>
          </serviceBehaviors>
          <endpointBehaviors>
            <behavior name="web">
              <webHttp />
            </behavior>
          </endpointBehaviors>
        </behaviors>
      </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>

    Alex

    Wednesday, January 16, 2013 12:40 PM

Answers

  • User-1662538993 posted

    Check this link -

    http://www.codeproject.com/Articles/36705/7-simple-steps-to-enable-HTTPS-on-WCF-WsHttp-bindi

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, January 16, 2013 5:24 PM

All replies

  • User-1662538993 posted

    Check this link -

    http://www.codeproject.com/Articles/36705/7-simple-steps-to-enable-HTTPS-on-WCF-WsHttp-bindi

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, January 16, 2013 5:24 PM
  • User-1000095884 posted

    I just recently got a valid certificate from godday installed the certifcate now if i access the service.svc with the browser everything looks good but now what ever function i try to call gives me a 400 bad request

    Hi,

    400 is a general error. Please get the internal error message with fiddler or enable tracing.

    From your code, you want to configure Https with BasicHttpBinding, please explain more clearly.

    Best Regards.

    Thursday, January 17, 2013 5:04 AM