create asp.net webservice for SSL HTTPS

2019-06-05 00:21发布

问题:

I use Visual Studio 2008... and have created an ASP.NET website. Within this website project, I have a Web Service file .asmx. Calling this service over HTTP works just fine. But there is now a requirement that it be called over SSL / HTTPS.

When I browse to the URL through HTTP, the .asmx and WSDL show up just fine. but as soon as i put HTTPS , the browser shows the message 'Internet Explorer cannot display the webpage'

We run this site on a windows 2003 server with IIS.

If easily possible, I would only want to call this service over HTTPS... and leave the rest of the pages in this project available over HTTP. If thats very difficult I can still create a new project for this service... but I still dont know how to allow it to be accessed over HTTPS.

Thanks in advance for any help!

Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Data

<WebService(Namespace:="http://services.vm.vmc/InstantAccount/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class MyWebService
    Inherits System.Web.Services.WebService

    <WebMethod()> _
    Public Function doSomething(ByVal p_String As String) As String
          Return "Test"
    End Function
End Class

回答1:

For anyone who may be wondering the same thing in the future... there were three steps to accomplishing this

1) change the Namespace to https, at the top of the code file

2) change IIS to enable HTTPS over the necessary port

3) create a signed certificate through IIS (we did a self-signed one)