开发者

ResponseSoapContext.Current is null

I have been running a web service code on my own machine along with the client code. It was running fine and managed to receive the Dime attachments sent from the web service to the client.

The web service uses WSE 2.0 and Dime attachments. The client code sits on the same machine that calls the web service.

However when I go to deploy this on a Windows 2003 R2 Server, on the ResponseSoapContext.Current.add(dimeAttachment) line it failed due to the ResponseSoapContext.Current object being null.

The client code has managed to call the web service as I can see in the logs it is trying to do something.

Would there be a firewall stopping the client code receiving the Dime attachment from the web service? Or is there a setting I am missing? Here is the code:

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

            if (ResponseSoapContext.开发者_JAVA技巧Current != null)
            {
                ResponseSoapContext.Current.Attachments.Add(dimeAttach);
            }
            else
            {
                throw new Exception("The ResponseSoapContext.Current object is null");
            }


It turns out the server had Microsoft WSE 2.0 SP2 installed where as the client was using Microsoft WSE 2.0 SP3.

Installed Microsoft WSE 2.0 SP3 on the server and updated the references and it all works now.


I had this problem and I solved it from my server web.config file by adding some configurations about WSE. My web.config(stripped settings not related to 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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜