【问题标题】:How to put the firewall request for outbound webservice如何将防火墙请求用于出站 Web 服务
【发布时间】:2014-07-17 23:10:01
【问题描述】:

从我的网络服务异常帖子继续前进

WebService Exception- The underlying connection was closed: An unexpected error occurred on a send

对于这个问题,我们假设我的网络请求发生了网络阻塞。
所以我联系了网络团队,然后,他们说在我的 Web 服务请求上放一个防火墙请求编号,然后他们就能够针对给定的防火墙请求解决我的 Web 服务问题。

我是“防火墙请求号”这个词的新手,请帮助我。
如何为我的以下 Web 方法提出防火墙请求?

请帮忙?

[WebMethod]
public XmlDocument GetData()
{
    string sError = "";

    string sApiSession;

    DateTime dtRequested = DateTime.Now;

    XmlDocument xmlDoc = new XmlDocument();
    XDocument xDoc = new XDocument();

    try
    {
        NetworkCredential creds = new NetworkCredential();

        creds.UserName = System.Configuration.ConfigurationManager.AppSettings.Get("UserName");
        creds.Password = System.Configuration.ConfigurationManager.AppSettings.Get("Password");
        WebRequest req = WebRequest.Create(System.Configuration.ConfigurationManager.AppSettings.Get("Services"));

        req.Method = System.Configuration.ConfigurationManager.AppSettings.Get("Method");
        req.ContentType = System.Configuration.ConfigurationManager.AppSettings.Get("ContentType ");
        req.Credentials = creds;

        //Retriev into webresponse
        WebResponse webResponse = req.GetResponse();

        //Read from WebResponse to datastream
        Stream dataStream = webResponse.GetResponseStream();

        //read the content of data stream
        using (StreamReader reader = new StreamReader(dataStream))
        {
            xDoc = XDocument.Load(reader);
        }
    }
    catch (Exception ex)
    {
        throw;
    }
    return xmlDoc = getXml(xDoc);
}  

【问题讨论】:

  • 不清楚你在问什么?当您说“请求编号”时,您是指端口吗?这取决于您的设置,但默认情况下 HTTP 请求通过端口 80,HTTPS 请求通过端口 443。您可能还指服务器的 IP 地址?你能澄清一下你需要什么吗?
  • 也许他们的意思是您应该添加某个标头,以便他们可以识别您的请求。我们不可能知道“防火墙请求号”是什么意思,因为他们组成了这个词;询问您的网络管理员他们的意思。

标签: c# web-services networking network-programming firewall


【解决方案1】:

这是我在 Google 中找不到的方式。 “防火墙请求号”是我们的内部请求,我们必须向网络管理员提出。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-19
    • 1970-01-01
    • 2011-12-03
    • 1970-01-01
    • 2019-04-26
    • 1970-01-01
    相关资源
    最近更新 更多