简体   繁体   中英

Could not find a base address that matches scheme https

Error: Could not find a base address that matches scheme https for the endpoint with binding WebHttpBinding. Registered base address schemes are [http]. Could not find a base address that matches scheme https for the endpoint with binding WebHttpBinding. Registered base address schemes are [http].

I've searched other answers and tried out different things, but my web service still isn't working. Note: I am new at this, but have experience in dev/web service. I only need the service to run on HTTPS, btw.

Web.config:

<system.serviceModel>
    <bindings>
        <webHttpBinding>
            <binding name="bindingHTTPS" crossDomainScriptAccessEnabled="true">
                <security mode="Transport">
                    <transport clientCredentialType="None"></transport>
                </security>
            </binding>
            <binding name="httpbind" crossDomainScriptAccessEnabled="true"></binding>
        </webHttpBinding>
    </bindings>
    <services>
        <service name="Personnel.Personnel" behaviorConfiguration="personnelBehavior">
            <endpoint address="" binding="webHttpBinding" bindingConfiguration="bindingHTTPS" contract="Personnel.IPersonnel" behaviorConfiguration="web"></endpoint>
            <endpoint address="" binding="webHttpBinding" bindingConfiguration="httpbind" contract="Personnel.IPersonnel" behaviorConfiguration="web"></endpoint>
        </service>
    </services>
    <behaviors>
        <serviceBehaviors>
            <behavior name="personnelBehavior">
                <serviceMetadata httpGetEnabled="true"/>
                <serviceDebug includeExceptionDetailInFaults="false"/>
            </behavior>
            <behavior>
                <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
                <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
                <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
                <serviceDebug includeExceptionDetailInFaults="false"/>
            </behavior>
        </serviceBehaviors>
        <endpointBehaviors>
            <behavior name="web">
                <webHttp/>
            </behavior>
        </endpointBehaviors>
    </behaviors>
    <protocolMapping>
        <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>

It worked fine until I added another method? So now I have two methods? in my web service:

[WebGet(UriTemplate="createOffboardTask/{resourceName}/{lastDay}/{submitter}",ResponseFormat=WebMessageFormat.Json, BodyStyle=WebMessageBodyStyle.Wrapped)]
        public string createOffboardTask(string resourceName, string lastDay, string submitter)
        {
            //do some stuff
        }

[WebGet(UriTemplate = "createOnboardTask/{resourceName}/{firstDay}/{submitter}/{itemID}", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)]
            public string createOnboardTask(string resourceName, string firstDay, string submitter, string itemID)
            {
                //do some stuff
            }

And I do have both operation contracts in the Ifile:

[OperationContract]
        string createOffboardTask(string resourceName, string lastDay, string submitter);

[OperationContract]
        string createOnboardTask(string resourceName, string firstDay, string submitter, string ID);

Add this to binding configuration.

<security mode="Transport"> 

Can refer this if you need here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM