2012-02-04 74 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