0
votes

Trying to deploy a super barebones WCF Web Service and test it locally. I'm getting an error:

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

I'll include my endpoint tags from the web.config file here:


    <services>
      <service name="Company.PrototypeWebService.PrototypeWebService">
        <endpoint address="" binding="basicHttpBinding" bindingConfiguration="secureHTTPBinding" contract="Company.PrototypeWebService.ServiceContracts.IPrototypeWebService" />
        <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
      </service>
    </services>

Is there something I'm missing here? I'm new to web service development.

1
It doesn't seem odd to you that the address attribute is empty? - mason
I'm going off a template from my employer which seems to work for similar web services ... it did seem a touch odd though. - Jack Arnold
Turns out I should be using the Visual Studio Publish tool ... Still figuring this out. More information to come - Jack Arnold
I abandoned this project and started fresh. I think the issue was that I started from the wrong template in Visual Studio, but I can't say for sure. Thanks for your information - Jack Arnold
yes, you need to use WCF Service Application template to deploy WCF project in IIS. - Ding Peng

1 Answers

0
votes

This is because your base address is Http, but I see that your metadata endpoint uses https, which is the cause of the error,modify your Service:

<services>
      <service name="Company.PrototypeWebService.PrototypeWebService">
        <endpoint address="" binding="basicHttpBinding" bindingConfiguration="secureHTTPBinding" contract="Company.PrototypeWebService.ServiceContracts.IPrototypeWebService" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
      </service>
</services>

Modify mexHttpsBinding to mexHttpBinding.

If you want to use https binding, you need to configure the SSL certificate on the server. Normally, it is more convenient to use https in IIS.

UPDATE

If hosted in IIS, we need to create the following WCF project:

enter image description here

The directory of this project looks like this:

enter image description here

We can deploy the project directly to IIS, set the base address when deploying in IIS, we do not need to configure the base address in the configuration file. This is the base address of the service:

enter image description here

After the deployment is successful, we click on the .svc file to view the service:

enter image description here