2012-02-04 89 views
2

我有參加一個字符串參數並返回一個JSON字符串一些ASMX Web服務。他們看起來像這樣:WCF和REST和SOAP

WebService(Namespace = "http://tempuri.org/")] 
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] 
[System.Web.Script.Services.ScriptService] 
public class MyService : System.Web.Services.WebService 
{ 
    [WebMethod(EnableSession = true)] 
    public string MyWebMethod1(string TheParameter1) 
    { 
      TheClassThatDoesTheWork MyClass = new TheClassThatDoesTheWork(); 
      return MyClass.DoTheWork1(TheParameter); 
    } 

    [WebMethod(EnableSession = true)] 
    public string MyWebMethod2(string TheParameter2) 
    { 
      TheClassThatDoesTheWork MyClass = new TheClassThatDoesTheWork(); 
      return MyClass.DoTheWork2(TheParameter); 
    } 
} 

目前,他們在HTTP中使用IIS。我想在Azure中移動應用程序,並將WCF用於Web服務,並使它們在HTTPS中工作。 這樣做的最好方法是什麼?

謝謝。

回答

0

一個WCF服務返回一個JSON的最佳方法是使用的WebHttpBinding,請參閱:http://msdn.microsoft.com/en-us/library/system.servicemodel.webhttpbinding.aspx

爲了確保它運行過來HTTPS/SSL。

+0

我必須在WCF的存取權限HTTPContext.Current.Session? – frenchie 2012-02-05 16:38:37

+0

你可以使用每個會話功能,內置的WCF此http://msdn.microsoft.com/en-us/magazine/cc163590.aspx – 2012-02-05 16:46:41

+0

好了,可以在用戶登錄的IIS(或天青)的應用程序和不知何故該會話也可以在WCF中訪問?我的應用程序中的用戶將使用表單身份驗證登錄,然後會對WCF服務進行ajax調用。 – frenchie 2012-02-05 16:53:27