0

我一直在我自己的机器上运行 Web 服务代码以及客户端代码。它运行良好并设法接收从 Web 服务发送到客户端的 Dime 附件。

Web 服务使用 WSE 2.0 和 Dime 附件。客户端代码位于调用 Web 服务的同一台机器上。

但是,当我在 Windows 2003 R2 服务器上部署它时,在 ResponseSoapContext.Current.add(dimeAttachment) 行上,由于 ResponseSoapContext.Current 对象为空,它失败了。

正如我在它试图做某事的日志中看到的那样,客户端代码已经成功地调用了 Web 服务。

是否会有防火墙阻止客户端代码从 Web 服务接收 Dime 附件?还是我缺少一个设置?这是代码:

            DimeAttachment dimeAttach = new DimeAttachment(
            "application/octet-stream", TypeFormat.MediaType,
            streamObj);

            if (ResponseSoapContext.Current != null)
            {
                ResponseSoapContext.Current.Attachments.Add(dimeAttach);
            }
            else
            {
                throw new Exception("The ResponseSoapContext.Current object is null");
            }
4

2 回答 2

1

事实证明,服务器安装了 Microsoft WSE 2.0 SP2,而客户端使用的是 Microsoft WSE 2.0 SP3。

在服务器上安装了 Microsoft WSE 2.0 SP3 并更新了引用,现在一切正常。

于 2010-10-01T10:29:03.023 回答
0

我遇到了这个问题,我通过添加一些关于 WSE 的配置从我的服务器 web.config 文件中解决了这个问题。我的 web.config(与 WSE 无关的剥离设置):

<?xml version="1.0"?>
<configuration>
  <configSections>
    <section name="microsoft.web.services2" type="Microsoft.Web.Services2.Configuration.WebServicesConfiguration, Microsoft.Web.Services2, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
  </configSections>

  <system.web>
    <webServices>
      <soapExtensionTypes>
        <add type="Microsoft.Web.Services2.WebServicesExtension, Microsoft.Web.Services2, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" priority="1" group="0" />
      </soapExtensionTypes>
    </webServices>
  </system.web>
  <microsoft.web.services2>
    <messaging>
      <maxRequestLength>1024000</maxRequestLength>
    </messaging>
    <diagnostics />
  </microsoft.web.services2>
</configuration>
于 2017-02-16T14:57:37.403 回答