create asp.net webservice for SSL HTTPS

痞子三分冷 提交于 2020-01-13 06:04:27

问题


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)



来源:https://stackoverflow.com/questions/10534209/create-asp-net-webservice-for-ssl-https

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!