3

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
adam
  • 2,930
  • 7
  • 54
  • 89
  • 3
    have you enabled ssl on IIS for the site? – Claudio Redi May 10 '12 at 12:46
  • probably not. I'll do a little googling to see how thats done. thanks! – adam May 10 '12 at 12:48
  • If IIS were enabled for this site in IIS... should i in theory be able to access the service over both HTTP and HTTPS if i wanted.. without changing the webservice? – adam May 10 '12 at 12:51
  • you'll need to enable ssl for the site and also installing a SSL certificate. On test environment you can use a self signed certificate. – Claudio Redi May 10 '12 at 12:51
  • This is exactly what i needed to know :) can you post this , in a bit more detail , as an answer please? I've never done an SSL certificate before, or self signed... absolutely 0 experience with it. – adam May 10 '12 at 12:54
  • Curious: why are you using an ASMX service? ASMX is a legacy technology that should not be used for new development. – John Saunders May 10 '12 at 12:59
  • In VS2008, we just went to File -> Add New -> Web Service. It just happened that the Web Service was a .ASMX file. This was (i guess) why we chose that option. What is the new and better way of creating a .NET webservice? – adam May 10 '12 at 13:05

1 Answers1

7

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)

adam
  • 2,930
  • 7
  • 54
  • 89