When using the webservice interface in C#, the IP address returned to the server is accompanied by a port number. But sometimes you can't use that port (for example, using nginx for forwarding), and you need to process it on the server side (the processing content is the following code). In addition, something needs to be added to system.web in web.config in the configuration file:
<webServices>
<protocols>
< ;add name="HttpGet"/>
<add name="HttpPost"/>
<add name="HttpSoap"/>
protocols>
<soapExtensionReflectorTypes>
<add type="CommMethod.OuterPortReflector,CommMethod"/>
soapExtensionReflectorTypes& gt;
webServices >
Note: 1. The content of type is the class name and package name. This is somewhat different from what the person on msdn wrote (it may be a version problem) (http://blogs.msdn.com/b/kaevans/archive/2005/11/16/493496.aspx).
2. If there is no content in protocols, it is possible that post and get requests cannot be correctly recognized (I have not verified it, but I have seen similar problems on the blog).
3.stackoverflow source address: http://stackoverflow.com/questions/1531448/asp-net-web-service-changes-port-on-invoke
Code:
//---- -------------------------------------------------- ------------------
//
// * Copyright (C)
// * version :
// * author : ying83811
// * FileName: OuterPortReflector.cs
// * history : created by ying83811
//
//------------- -------------------------------------------------- -------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Services.Description;
namespace Better517Na.KoreaProductInterface.CommMethod
{
///
’’ Rewrite ReflectMethod
///
public override void ReflectDescription()
{
.
foreach ( Service service in description.Services)
SoapAddressBinding binding = extension as SoapAddressBinding;
if (null != binding)
{
binding.Location = binding.Location.Replace(portNum, string.Empty); Location.Replace(portNum, string.Empty);
Soap12AddressBinding soap12Binding = extension as Soap12AddressBinding;
Empty);
}
}
}
}