none
How do I add a Service Reference to an https web service RRS feed

  • Question

  • To add a Service Reference to my Excel VSTO Add-In in VS2017 I select: 

    Project - Add Service Reference and enter the address to a wsdl using a https url 

    It correctly adds the Service Reference and adds the Endpoints in the app.config.

     <endpoint address="https://myserver/MyApp/FooService"
                    binding="basicHttpBinding" bindingConfiguration="MXLPortBinding2"
                    contract="ServiceReference1.MXL" name="MXLPort1" />

    (A binding is also created in the App.config that has the Security mode = "Transport")

    I then use this code to test the webservice:

            Try
                Dim ws As New ServiceReference1.MXLClient("MXLPort1")
                Dim strReturn As String = ws.Test_HelloWorld
                System.Diagnostics.Debug.Print(strReturn)
            Catch ex As Exception
                System.Diagnostics.Debug.Print(ex.Message)
            End Try


    The line  ws.Test_HelloWorld gives the following exception:

    An error occurred while making the HTTP request to https://myserver/myApp/FooService. This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case. This could also be caused by a mismatch of the security binding between the client and the server.

    The same process works fine and gives no exception  if I use a URL to an http address.

    If I create a Console application instead of a VSTO the service reference to the https address works fine.

    Is it possible to create a Service Reference to an https address in an Excel VSTO Add-in?

    If so, what changes do I need to make to my VSTO project?




    • Edited by MerlinXL Tuesday, January 15, 2019 6:30 PM
    Tuesday, January 15, 2019 1:37 PM

Answers