单声道.Web API服务在外部调用表单时返回0



我的Web API服务运行在带有Mono和Nginx的Linux Ubuntu上。

当我从本地主机测试我的API时,它运行良好,并将每个请求写入日志文件,但如果我从外部环境(从其他IP)调用一个方法,则响应为:

The web service returned the following result: 0 -

而且它没有写任何错误日志,所以我可以调查这个问题。

这是我的方法:

[WebMethod]
public string Test(string strXML)
{
    string strMessage = "";
    XmlDocument xdoc = new XmlDocument();
    try
    {
        xdoc.LoadXml(strXML);
        XmlNode xContent = xdoc.GetElementsByTagName("content")[0];
        strMessage = xContent.InnerText;
    }
    catch (Exception ex)
    {
    }
    return strMessage;
}

你们有什么建议吗?

试试marc.d在这篇文章中的答案:

使用Android 调用SOAP Web服务时连接被拒绝

这对我的情况有帮助。

最新更新