giovedì 3 dicembre 2020

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

Durante lo sviluppo di applicazioni, può capitare che utilizzando un servizio web di tipo WCF, che richiede credenziali e soprattutto una connessione protetta di tipo https, il file di configurazione va impostato con i parametri di tale connessione. In particolare il securitymode impostato a Transport ed i vari sotto tag.

Questo per evitare che generi il seguente errore

The provided URI scheme 'https' is invalid; expected 'http'.

Parameter name: via

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.


Exception Details: System.ArgumentException: The provided URI scheme 'https' is invalid; expected 'http'.

Parameter name: via




Qui di seguito il file Webconfig con i dovuti accorgimenti tra cui valore "Windows" per il parametro ClientCredentialType. Vedere anche il seguente post https://emanuelemattei.blogspot.com/2018/06/c-schema-uri-fornito-https-non-valido.html 



<bindings>

      <basicHttpBinding>

        <binding name="NomeWebServicePortBinding" receiveTimeout="00:10:00" sendTimeout="00:10:00"

            maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Mtom">

          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"

                maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />

          <security mode="Transport">

            <transport clientCredentialType="Windows" proxyCredentialType="None" realm="" />

            <message clientCredentialType="Certificate" algorithmSuite="Default" />

          </security>

        </binding>

      </basicHttpBinding>

    </bindings>

Nessun commento: