WebService behind reverse proxy

前端 未结 1 812
感情败类
感情败类 2021-01-03 00:03

I have a web service which is behind a reverse proxy like this:

\"reverse

Now what is happening

相关标签:
1条回答
  • 2021-01-03 00:28

    What I did to solve a similar problem was to force the webservice to emit the correct headers.

    You can do the following:

    1. Create the following class in the App_Code folder:

      using System;
      using System.Web.Services.Description;
      
      namespace Msdn.Web.Services.Samples
      {
        /// <summary> Summary description for WSDLReflector </summary>
        public class WSDLReflector : SoapExtensionReflector
        {
          public override void ReflectMethod()
          {
            //no-op
          }
      
          public override void ReflectDescription()
          {
            ServiceDescription description = ReflectionContext.ServiceDescription;
            foreach (Service service in description.Services)
            {
              foreach (Port port in service.Ports)
              {
                foreach (ServiceDescriptionFormatExtension extension in port.Extensions)
                {
                  SoapAddressBinding binding = extension as SoapAddressBinding;
                  if (null != binding)
                  {
                    binding.Location = binding.Location.Replace("http://mywebservice.comp.com", "https://uat.mywebservice.com");
                  }
                }
              }
            }
          }
        }
      }
      
    2. And add this to web.config:

      <webServices>
        <diagnostics suppressReturningExceptions="true" />
        <soapExtensionReflectorTypes>
          <add type="Msdn.Web.Services.Samples.WSDLReflector,App_Code"/>
        </soapExtensionReflectorTypes>
      </webServices>
      
    0 讨论(0)
提交回复
热议问题