문제

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.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>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top