ResponseSoapContext.Current为null
-
27-09-2019 - |
题
我一直与客户代码一起经营自己的机器上的Web服务代码。它运行良好和管理,以接收来自Web服务发送给客户端的角钱附件。
在web服务使用WSE 2.0和迪梅附件。客户机代码位于调用web服务的相同的机器上。
然而,当我去到Windows 2003 R2服务器上部署此,它失败ResponseSoapContext.Current.add(dimeAttachment)线因ResponseSoapContext.Current对象为空。
在客户端代码已设法调用Web服务,我可以在它试图做一些事情的日志中看到。
会有防火墙停止客户端代码接收来自所述web服务的迪梅附件?还是有我缺少一个设置?下面是代码:
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");
}
解决方案
原来服务器已经微软WSE 2.0 SP2安装位置作为客户端是使用微软WSE 2.0 SP3。
安装Microsoft WSE 2.0 SP3的服务器上,并更新了参考,这一切工作了。
其他提示
我有这个问题,我加入约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>
不隶属于 StackOverflow