简体   繁体   English

为SSL HTTPS创建asp.net Web服务

[英]create asp.net webservice for SSL HTTPS

I use Visual Studio 2008... and have created an ASP.NET website. 我使用Visual Studio 2008 ...,并创建了一个ASP.NET网站。 Within this website project, I have a Web Service file .asmx. 在此网站项目中,我有一个Web服务文件.asmx。 Calling this service over HTTP works just fine. 通过HTTP调用此服务就可以了。 But there is now a requirement that it be called over SSL / HTTPS. 但是现在有一个要求,它必须通过SSL / HTTPS来调用。

When I browse to the URL through HTTP, the .asmx and WSDL show up just fine. 当我通过HTTP浏览到URL时,.asmx和WSDL会很好地显示出来。 but as soon as i put HTTPS , the browser shows the message 'Internet Explorer cannot display the webpage' 但是,只要我输入HTTPS,浏览器就会显示消息“ Internet Explorer无法显示该网页”

We run this site on a windows 2003 server with IIS. 我们在带有IIS的Windows 2003服务器上运行此站点。

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. 如果可能的话,我只想通过HTTPS调用此服务...,并通过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. 如果那非常困难,我仍然可以为此服务创建一个新项目...但是我仍然不知道如何允许通过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

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 1)将代码文件顶部的命名空间更改为https

2) change IIS to enable HTTPS over the necessary port 2)更改IIS以通过必要的端口启用HTTPS

3) create a signed certificate through IIS (we did a self-signed one) 3)通过IIS创建签名证书(我们做了一个自签名证书)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM