2011-10-19 105 views
1

我開發了簡單的http:// Web服務並進行了部署。現在我們正計劃在網站上獲得證書。我需要更改我的代碼嗎?我是SSL方面的新手。http://和https:// web服務?

請諮詢我

+0

這個問題將是對[Webmasters.SE] –

+0

更好您是否使用ASP.NET網站?如果是這樣,沒有改變。如果您通過IIS使用WCF,則可能需要更改傳輸綁定。 –

+0

這是簡單的asp.net網站。 – James123

回答

4

您需要更改配置文件中的消耗你的新網址服務的任何客戶端應用程序。

您的Web服務應用程序不應該需要任何更改。 IIS將使用SSL證書處理傳輸加密。

這是值得一讀:

http://msdn.microsoft.com/en-us/library/ff649205.aspx

2

您的問題 簡單的解決方案創建具有以下

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配置帶班以下

<soapExtensionReflectorTypes> 

    <add type="xxx.WebServices.HTTP.HttpsReflector, App_code"/> 

</soapExtensionReflectorTypes>