gpt4 book ai didi

asp.net - WCF 和 REST 与 SOAP

转载 作者:行者123 更新时间:2023-12-02 07:32:32 25 4
gpt4 key购买 nike

我有一些 ASMX Web 服务,它们接受字符串参数并返回 json 字符串。它们看起来像这样:

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 中工作。最好的方法是什么?

谢谢。

最佳答案

WCF 服务返回 JSON 的最佳方式是使用 webhttpbinding,请参阅:http://msdn.microsoft.com/en-us/library/system.servicemodel.webhttpbinding.aspx

为了确保其安全,请通过 HTTPS/SSL 运行它。

关于asp.net - WCF 和 REST 与 SOAP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9141148/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com