简体   繁体   English

WCF,REST和SOAP

[英]WCF & REST & SOAP

I have some ASMX web services that take in a string parameter and return a json string. 我有一些ASMX Web服务,它们接受一个字符串参数并返回一个json字符串。 They look like this: 他们看起来像这样:

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);
     }
}

For the moment, they work on IIS in HTTP. 目前,它们可以在HTTP中的IIS上工作。 I want to move the app in Azure, and use WCF for the web services and make them work in HTTPS. 我想在Azure中移动该应用程序,并将WCF用于Web服务,并使它们在HTTPS中工作。 What's the best way to do this? 最好的方法是什么?

Thanks. 谢谢。

Best way for a WCF service to return a JSON is to use webhttpbinding, see: http://msdn.microsoft.com/en-us/library/system.servicemodel.webhttpbinding.aspx WCF服务返回JSON的最佳方法是使用webhttpbinding,请参阅: http : //msdn.microsoft.com/zh-cn/library/system.servicemodel.webhttpbinding.aspx

To secure it run it over HTTPS/SSL. 要确保其安全,请通过HTTPS / SSL运行它。

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

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