C# http://和https://web服务?
我开发并部署了简单的http://Web服务。现在我们正计划在网站上获得证书。我的代码需要更改吗?我对SSL方面是新手C# http://和https://web服务?,c#,asp.net,web-services,C#,Asp.net,Web Services,我开发并部署了简单的http://Web服务。现在我们正计划在网站上获得证书。我的代码需要更改吗?我对SSL方面是新手 请告知我您需要将使用您的服务的任何客户端应用程序中的配置文件更改为新的URL 您的web服务应用程序不需要任何更改。IIS将使用SSL证书处理传输加密 这值得一读: 轻松解决您的问题 使用下面给出的代码创建一个类 public class HttpsReflector : SoapExtensionReflector { public override void Ref
请告知我您需要将使用您的服务的任何客户端应用程序中的配置文件更改为新的URL 您的web服务应用程序不需要任何更改。IIS将使用SSL证书处理传输加密 这值得一读:
轻松解决您的问题 使用下面给出的代码创建一个类
public class HttpsReflector : SoapExtensionReflector
{
public override void ReflectMethod()
{
//no-op
}
public override void ReflectDescription()
{
ServiceDescription description = ReflectionContext.ServiceDescription;
foreach (Service service in description.Services)
{
foreach (Port port in service.Ports)
{
foreach (ServiceDescriptionFormatExtension extension in port.Extensions)
{
SoapAddressBinding binding = extension as SoapAddressBinding;
if (null != binding)
{
binding.Location = binding.Location.Replace("http://", "https://");
}
}
}
}
}
}
}
使用以下命令更改web配置
如果您使用的是ASP.NET网站,这个问题会更好?如果是的话,没有变化。如果您在IIS上使用WCF,则可能需要更改传输绑定。这是一个简单的asp.net网站。
<soapExtensionReflectorTypes>
<add type="xxx.WebServices.HTTP.HttpsReflector, App_code"/>
</soapExtensionReflectorTypes>