5
<?xml version="1.0" encoding="UTF-8"?>
<configuration>  

  <system.web>
    <compilation debug="true" strict="false" explicit="true" targetFramework="4.0" />
    <httpRuntime maxRequestLength="2097151" executionTimeout="2000" requestValidationMode="2.0" />
    <authentication mode="Windows" />   
    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID" validateRequest="false" />    
  </system.web>

  <system.webServer>
    <handlers>
      <remove name="ScriptHandlerFactory"/>
      <remove name="ScriptHandlerFactoryAppServices"/>
      <remove name="ScriptResource"/>
      <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    </handlers>    
  </system.webServer>



  <system.serviceModel>
    <services>
      <service behaviorConfiguration="Complete_Html5.CompleteService.CompleteServiceAspNetAjaxBehavior" name="Complete_Html5.CompleteService.Complete">
        <endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_Complete" contract="Complete_Html5.CompleteService.Complete" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
      <service name="Complete_Html5.Service1" behaviorConfiguration="Complete_Html5.Service1ServiceAspNetAjaxBehavior">
        <endpoint address="" binding="basicHttpBinding" contract="Complete_Html5.Service1" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
    </services>

    <behaviors>
      <endpointBehaviors>
        <behavior name="Complete_Html5.Service1AspNetAjaxBehavior">
          <enableWebScript />
        </behavior>
        <behavior name="Complete_Html5.CompleteService.CompleteServiceAspNetAjaxBehavior">
          <enableWebScript />
        </behavior>
      </endpointBehaviors>      
      <serviceBehaviors>
        <behavior name="Complete_Html5.CompleteService.CompleteServiceAspNetAjaxBehavior">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>        
        <behavior name="Complete_Html5.Service1ServiceAspNetAjaxBehavior">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>        
      </serviceBehaviors>      
    </behaviors>

    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_Complete" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="10485760" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />

          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
        <binding name="BasicHttpBinding_Complete1" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
        <binding name="BasicHttpBinding_Service1" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="10485760" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true" messageEncoding="Text">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
        <binding name="BasicHttpBinding_Service11" />
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="https://www.examplete.com:83/CompleteService/Complete.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_Complete" contract="Complete_Html5.CompleteService.Complete" name="BasicHttpBinding_Complete" />
      <endpoint address="https://www.examplete.com:83/CompleteService/Complete.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_Complete1" contract="PMCService.Complete" name="BasicHttpBinding_Complete1" />
      <endpoint address="https://www.examplete.com:83/Service1.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_Service1" contract="ReportService.Service1" name="BasicHttpBinding_Service1" />
      <endpoint address="https://www.examplete.com:83/Service1.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_Service11" contract="ReportService.Service1" name="BasicHttpBinding_Service11" />
    </client>
  </system.serviceModel>
  <location path="images">
    <system.webServer>
      <staticContent>
        <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="10:00:00" />
      </staticContent>
    </system.webServer>
  </location>


  <location path="Scripts">
    <system.webServer>
      <staticContent>
        <clientCache cacheControlMode="UseExpires" cacheControlMaxAge="10:00:00" />
      </staticContent>
    </system.webServer>
  </location>

</configuration>

I found lots many questions and solution on same forum but I don't get that, each one have same error but different type causes. Our website which running fine for http and now we have added new ssl certification to Windows Server 2012 r2 server and trying to use https as well(both http and https). But when performing operation with https gives error as:

The provided URI scheme https is invalid; expected http. Parameter name: via.

But wants to run site for both request http and https.

Kaishu
  • 377
  • 1
  • 7
  • 21
  • Possible duplicate of [The provided URI scheme 'https' is invalid; expected 'http'.Parameter name: via](http://stackoverflow.com/questions/9010637/the-provided-uri-scheme-https-is-invalid-expected-http-parameter-name-via) – TGlatzer Feb 17 '16 at 12:51

1 Answers1

9

You will have to Change your bindingConfiguration to support transport security or change your binding to an basicHttpsBinding (which is available with WCF 4.5)

<bindings>
  <basicHttpBinding>
    <binding name="myBinding">
      <security mode="Transport" />        
    </binding>
  </basicHttpBinding>
</bindings>

or

<endpoint address="" binding="basicHttpsBinding" ... />

You can read more in this answer: What is the difference between BasicHttpsBinding and WsHttpBinding with Transport security?

Community
  • 1
  • 1
TGlatzer
  • 5,815
  • 2
  • 25
  • 46
  • where and what change do I have to make in web.config, and after done that, do I have to update service reference? – Kaishu Feb 17 '16 at 11:40
  • 1
    I have tried by making `security mode` to `transport` but it not works. Is there any need to update reference as one of forum suggest me to update that even though change in web.config? – Kaishu Feb 17 '16 at 12:09
  • Well, since any other question about that topic in SO essentially shows, that this is a solution, I'd expect you did not change all or not the correct entries. – TGlatzer Feb 17 '16 at 12:49
  • .@TGlatzer, for first option I have made changes only to three places as bindings>basicHttpBinding>binding>security mode="Transport". Is there need to make changes somewhere else?? – Kaishu Feb 17 '16 at 13:01
  • Jup, `Complete_Html5.Service1` uses the default bindingConfiguration for example - you have to adjust that as well... – TGlatzer Feb 17 '16 at 13:03